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