AMBARI-21581 - Replace Hard Coded conf-select Structures (jonathanhurley)
[ambari.git] / ambari-server / src / main / resources / common-services / HIVE / 0.12.0.2.0 / package / scripts / hive_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 import sys
21 from resource_management.libraries.script.script import Script
22 from resource_management.libraries.functions import stack_select
23 from resource_management.libraries.functions.constants import StackFeature
24 from resource_management.libraries.functions.stack_features import check_stack_feature
25 from resource_management.core.logger import Logger
26 from hive import hive
27 from ambari_commons.os_family_impl import OsFamilyImpl
28 from ambari_commons import OSConst
29 from resource_management.core.exceptions import ClientComponentHasNoStatus
30
31 class HiveClient(Script):
32 def install(self, env):
33 import params
34 self.install_packages(env)
35 self.configure(env)
36
37 def status(self, env):
38 raise ClientComponentHasNoStatus()
39
40 def configure(self, env):
41 import params
42 env.set_params(params)
43 hive(name='client')
44
45
46 @OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY)
47 class HiveClientWindows(HiveClient):
48 pass
49
50
51 @OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT)
52 class HiveClientDefault(HiveClient):
53 def pre_upgrade_restart(self, env, upgrade_type=None):
54 Logger.info("Executing Hive client Stack Upgrade pre-restart")
55
56 import params
57 env.set_params(params)
58 if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
59 stack_select.select_packages(params.version)
60
61
62 if __name__ == "__main__":
63 HiveClient().execute()