AMBARI-21581 - Replace Hard Coded conf-select Structures (jonathanhurley)
[ambari.git] / ambari-server / src / main / resources / common-services / HDFS / 3.0.0.3.0 / package / scripts / hdfs_client.py
1 """
2 Licensed to the Apache Software Foundation (ASF) under one
3 or more contributor license agreements. See the NOTICE file
4 distributed with this work for additional information
5 regarding copyright ownership. The ASF licenses this file
6 to you under the Apache License, Version 2.0 (the
7 "License"); you may not use this file except in compliance
8 with the License. You may obtain a copy of the License at
9
10 http://www.apache.org/licenses/LICENSE-2.0
11
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an "AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License for the specific language governing permissions and
16 limitations under the License.
17
18 """
19
20 from resource_management.libraries.script.script import Script
21 from resource_management.libraries.functions import stack_select
22 from resource_management.libraries.functions.constants import StackFeature
23 from resource_management.libraries.functions.stack_features import check_stack_feature
24 from resource_management.libraries.functions.security_commons import build_expectations, \
25 cached_kinit_executor, get_params_from_filesystem, validate_security_config_properties, \
26 FILE_TYPE_XML
27 from hdfs import hdfs
28 from ambari_commons.os_family_impl import OsFamilyImpl
29 from ambari_commons import OSConst
30 from resource_management.core.exceptions import ClientComponentHasNoStatus
31
32 class HdfsClient(Script):
33
34 def install(self, env):
35 import params
36 env.set_params(params)
37 self.install_packages(env)
38 self.configure(env)
39
40 def configure(self, env):
41 import params
42 env.set_params(params)
43 hdfs()
44
45 def start(self, env, upgrade_type=None):
46 import params
47 env.set_params(params)
48
49 def stop(self, env, upgrade_type=None):
50 import params
51 env.set_params(params)
52
53 def status(self, env):
54 raise ClientComponentHasNoStatus()
55
56 @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
57 class HdfsClientDefault(HdfsClient):
58
59 def pre_upgrade_restart(self, env, upgrade_type=None):
60 import params
61 env.set_params(params)
62 if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
63 stack_select.select_packages(params.version)
64
65 @OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
66 class HdfsClientWindows(HdfsClient):
67 def install(self, env):
68 import install_params
69 self.install_packages(env)
70 self.configure(env)
71
72 if __name__ == "__main__":
73 HdfsClient().execute()