Browse Source

AMBARI-3798. Add to base script separate method to install packages needed by service (Dmitry Lysnichenko)

Lisnichenko Dmitro 11 years ago
parent
commit
1d1e49ce9d
42 changed files with 1008 additions and 26 deletions
  1. 1 1
      ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
  2. 22 0
      ambari-agent/src/main/python/resource_management/__init__.py
  3. 22 0
      ambari-agent/src/main/python/resource_management/core/__init__.py
  4. 21 1
      ambari-agent/src/main/python/resource_management/core/base.py
  5. 22 2
      ambari-agent/src/main/python/resource_management/core/environment.py
  6. 22 0
      ambari-agent/src/main/python/resource_management/core/exceptions.py
  7. 22 0
      ambari-agent/src/main/python/resource_management/core/providers/__init__.py
  8. 22 0
      ambari-agent/src/main/python/resource_management/core/providers/accounts.py
  9. 22 0
      ambari-agent/src/main/python/resource_management/core/providers/mount.py
  10. 22 0
      ambari-agent/src/main/python/resource_management/core/providers/package/__init__.py
  11. 22 0
      ambari-agent/src/main/python/resource_management/core/providers/package/yumrpm.py
  12. 22 0
      ambari-agent/src/main/python/resource_management/core/providers/package/zypper.py
  13. 22 0
      ambari-agent/src/main/python/resource_management/core/providers/service.py
  14. 22 0
      ambari-agent/src/main/python/resource_management/core/providers/system.py
  15. 23 1
      ambari-agent/src/main/python/resource_management/core/shell.py
  16. 22 0
      ambari-agent/src/main/python/resource_management/core/source.py
  17. 22 0
      ambari-agent/src/main/python/resource_management/core/system.py
  18. 23 1
      ambari-agent/src/main/python/resource_management/core/utils.py
  19. 23 1
      ambari-agent/src/main/python/resource_management/libraries/__init__.py
  20. 22 0
      ambari-agent/src/main/python/resource_management/libraries/functions/__init__.py
  21. 23 1
      ambari-agent/src/main/python/resource_management/libraries/functions/default.py
  22. 23 1
      ambari-agent/src/main/python/resource_management/libraries/functions/format.py
  23. 23 1
      ambari-agent/src/main/python/resource_management/libraries/providers/__init__.py
  24. 23 1
      ambari-agent/src/main/python/resource_management/libraries/providers/execute_hadoop.py
  25. 23 1
      ambari-agent/src/main/python/resource_management/libraries/providers/template_config.py
  26. 23 1
      ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py
  27. 22 0
      ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py
  28. 23 1
      ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py
  29. 23 1
      ambari-agent/src/main/python/resource_management/libraries/resources/template_config.py
  30. 23 1
      ambari-agent/src/main/python/resource_management/libraries/resources/xml_config.py
  31. 22 0
      ambari-agent/src/main/python/resource_management/libraries/script/__init__.py
  32. 41 2
      ambari-agent/src/main/python/resource_management/libraries/script/script.py
  33. 90 0
      ambari-agent/src/test/python/TestScript.py
  34. 21 0
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/__init__.py
  35. 23 1
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/functions.py
  36. 23 1
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase.py
  37. 23 1
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_client.py
  38. 23 1
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_master.py
  39. 23 1
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_regionserver.py
  40. 24 2
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_service.py
  41. 23 1
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/params.py
  42. 22 0
      ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/service_check.py

+ 1 - 1
ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py

@@ -99,6 +99,6 @@ class CustomServiceOrchestrator():
     file_path = os.path.join(self.tmp_dir, "command-{0}.json".format(task_id))
     file_path = os.path.join(self.tmp_dir, "command-{0}.json".format(task_id))
     # Command json contains passwords, that's why we need proper permissions
     # Command json contains passwords, that's why we need proper permissions
     with os.fdopen(os.open(file_path, os.O_WRONLY | os.O_CREAT,0600), 'w') as f:
     with os.fdopen(os.open(file_path, os.O_WRONLY | os.O_CREAT,0600), 'w') as f:
-      content = json.dumps(command)
+      content = json.dumps(command, sort_keys = False, indent = 4)
       f.write(content)
       f.write(content)
     return file_path
     return file_path

+ 22 - 0
ambari-agent/src/main/python/resource_management/__init__.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.libraries import *
 from resource_management.libraries import *
 from resource_management.core import *
 from resource_management.core import *
 
 

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/__init__.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.core.base import *
 from resource_management.core.base import *
 from resource_management.core.environment import *
 from resource_management.core.environment import *
 from resource_management.core.exceptions import *
 from resource_management.core.exceptions import *

+ 21 - 1
ambari-agent/src/main/python/resource_management/core/base.py

@@ -1,4 +1,24 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
 
 
 __all__ = ["Resource", "ResourceArgument", "ForcedListArgument",
 __all__ = ["Resource", "ResourceArgument", "ForcedListArgument",
            "BooleanArgument"]
            "BooleanArgument"]

+ 22 - 2
ambari-agent/src/main/python/resource_management/core/environment.py

@@ -1,4 +1,24 @@
-#!/usr/bin/env python
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
 
 
 __all__ = ["Environment"]
 __all__ = ["Environment"]
 
 
@@ -184,4 +204,4 @@ class Environment(object):
     self.config = state['config']
     self.config = state['config']
     self.resources = state['resources']
     self.resources = state['resources']
     self.resource_list = state['resource_list']
     self.resource_list = state['resource_list']
-    self.delayed_actions = state['delayed_actions']
+    self.delayed_actions = state['delayed_actions']

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/exceptions.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 class Fail(Exception):
 class Fail(Exception):
   pass
   pass
 
 

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/providers/__init__.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 __all__ = ["Provider", "find_provider"]
 __all__ = ["Provider", "find_provider"]
 
 
 import logging
 import logging

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/providers/accounts.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from __future__ import with_statement
 from __future__ import with_statement
 
 
 import grp
 import grp

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/providers/mount.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from __future__ import with_statement
 from __future__ import with_statement
 
 
 import os
 import os

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/providers/package/__init__.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.core.base import Fail
 from resource_management.core.base import Fail
 from resource_management.core.providers import Provider
 from resource_management.core.providers import Provider
 
 

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/providers/package/yumrpm.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.core.providers.package import PackageProvider
 from resource_management.core.providers.package import PackageProvider
 from resource_management.core import shell
 from resource_management.core import shell
 
 

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/providers/package/zypper.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.core.providers.package import PackageProvider
 from resource_management.core.providers.package import PackageProvider
 from resource_management.core import shell
 from resource_management.core import shell
 
 

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/providers/service.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 import os
 import os
 
 
 from resource_management.core import shell
 from resource_management.core import shell

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/providers/system.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from __future__ import with_statement
 from __future__ import with_statement
 
 
 import grp
 import grp

+ 23 - 1
ambari-agent/src/main/python/resource_management/core/shell.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 __all__ = ["checked_call"]
 __all__ = ["checked_call"]
 
 
 import logging
 import logging
@@ -48,4 +70,4 @@ def _call(command, logoutput=False, throw_on_failure=True,
     err_msg = ("Execution of '%s' returned %d. %s") % (command[-1], code, out)
     err_msg = ("Execution of '%s' returned %d. %s") % (command[-1], code, out)
     raise Fail(err_msg)
     raise Fail(err_msg)
   
   
-  return code, out
+  return code, out

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/source.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from __future__ import with_statement
 from __future__ import with_statement
 from resource_management.core.environment import Environment
 from resource_management.core.environment import Environment
 from resource_management.core.utils import checked_unite
 from resource_management.core.utils import checked_unite

+ 22 - 0
ambari-agent/src/main/python/resource_management/core/system.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 __all__ = ["System"]
 __all__ = ["System"]
 
 
 import os
 import os

+ 23 - 1
ambari-agent/src/main/python/resource_management/core/utils.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.core.exceptions import Fail
 from resource_management.core.exceptions import Fail
 
 
 class AttributeDictionary(object):
 class AttributeDictionary(object):
@@ -80,4 +102,4 @@ def checked_unite(dict1, dict2):
   result = dict1.copy()
   result = dict1.copy()
   result.update(dict2)
   result.update(dict2)
   
   
-  return result
+  return result

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/__init__.py

@@ -1,4 +1,26 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.libraries.functions import *
 from resource_management.libraries.functions import *
 from resource_management.libraries.resources import *
 from resource_management.libraries.resources import *
 from resource_management.libraries.providers import *
 from resource_management.libraries.providers import *
-from resource_management.libraries.script import *
+from resource_management.libraries.script import *

+ 22 - 0
ambari-agent/src/main/python/resource_management/libraries/functions/__init__.py

@@ -1,2 +1,24 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.libraries.functions.default import *
 from resource_management.libraries.functions.default import *
 from resource_management.libraries.functions.format import *
 from resource_management.libraries.functions.format import *

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/functions/default.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 __all__ = ["default"]
 __all__ = ["default"]
 
 
 from resource_management.libraries.script import Script
 from resource_management.libraries.script import Script
@@ -16,4 +38,4 @@ def default(name, default_value=None):
     else:
     else:
       return default_value
       return default_value
 
 
-  return curr_dict
+  return curr_dict

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/functions/format.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 __all__ = ["format"]
 __all__ = ["format"]
 import sys
 import sys
 from string import Formatter
 from string import Formatter
@@ -21,4 +43,4 @@ def format(format_string, *args, **kwargs):
   
   
   result = checked_unite(kwargs, variables)
   result = checked_unite(kwargs, variables)
   result.pop("self", None) # self kwarg would result in an error
   result.pop("self", None) # self kwarg would result in an error
-  return ConfigurationFormatter().format(format_string, args, **result)
+  return ConfigurationFormatter().format(format_string, args, **result)

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/providers/__init__.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 PROVIDERS = dict(
 PROVIDERS = dict(
   redhat=dict(
   redhat=dict(
   ),
   ),
@@ -14,4 +36,4 @@ PROVIDERS = dict(
     TemplateConfig="resource_management.libraries.providers.template_config.TemplateConfigProvider",
     TemplateConfig="resource_management.libraries.providers.template_config.TemplateConfigProvider",
     XmlConfig="resource_management.libraries.providers.xml_config.XmlConfigProvider"
     XmlConfig="resource_management.libraries.providers.xml_config.XmlConfigProvider"
   ),
   ),
-)
+)

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/providers/execute_hadoop.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 import pipes
 import pipes
 from resource_management import *
 from resource_management import *
 
 
@@ -29,4 +51,4 @@ class ExecuteHadoopProvider(Provider):
         try_sleep   = self.resource.try_sleep,
         try_sleep   = self.resource.try_sleep,
         logoutput   = self.resource.logoutput,
         logoutput   = self.resource.logoutput,
       )
       )
-    env.run()
+    env.run()

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/providers/template_config.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 import os
 import os
 from resource_management import *
 from resource_management import *
 
 
@@ -19,4 +41,4 @@ class TemplateConfigProvider(Provider):
        mode    = self.resource.mode,
        mode    = self.resource.mode,
        content = Template(template_name, extra_imports=self.resource.extra_imports)
        content = Template(template_name, extra_imports=self.resource.extra_imports)
       )
       )
-    env.run()
+    env.run()

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 import time
 import time
 from resource_management import *
 from resource_management import *
 
 
@@ -27,4 +49,4 @@ class XmlConfigProvider(Provider):
         group = self.resource.group,
         group = self.resource.group,
         mode = self.resource.mode
         mode = self.resource.mode
       )
       )
-    env.run()
+    env.run()

+ 22 - 0
ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.libraries.resources.execute_hadoop import *
 from resource_management.libraries.resources.execute_hadoop import *
 from resource_management.libraries.resources.template_config import *
 from resource_management.libraries.resources.template_config import *
 from resource_management.libraries.resources.xml_config import *
 from resource_management.libraries.resources.xml_config import *

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 _all__ = ["ExecuteHadoop"]
 _all__ = ["ExecuteHadoop"]
 from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
 from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
 
 
@@ -18,4 +40,4 @@ class ExecuteHadoop(Resource):
   kinit_path_local = ResourceArgument()
   kinit_path_local = ResourceArgument()
   
   
   actions = Resource.actions + ["run"]
   actions = Resource.actions + ["run"]
-  
+  

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/resources/template_config.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 _all__ = ["TemplateConfig"]
 _all__ = ["TemplateConfig"]
 from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
 from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
 
 
@@ -10,4 +32,4 @@ class TemplateConfig(Resource):
   template_tag = ResourceArgument()
   template_tag = ResourceArgument()
   extra_imports = ResourceArgument(default=[])
   extra_imports = ResourceArgument(default=[])
 
 
-  actions = Resource.actions + ["create"]
+  actions = Resource.actions + ["create"]

+ 23 - 1
ambari-agent/src/main/python/resource_management/libraries/resources/xml_config.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 _all__ = ["XmlConfig"]
 _all__ = ["XmlConfig"]
 from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
 from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
 
 
@@ -12,4 +34,4 @@ class XmlConfig(Resource):
   owner = ResourceArgument()
   owner = ResourceArgument()
   group = ResourceArgument()
   group = ResourceArgument()
 
 
-  actions = Resource.actions + ["create"]
+  actions = Resource.actions + ["create"]

+ 22 - 0
ambari-agent/src/main/python/resource_management/libraries/script/__init__.py

@@ -1 +1,23 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management.libraries.script.script import *
 from resource_management.libraries.script.script import *

+ 41 - 2
ambari-agent/src/main/python/resource_management/libraries/script/script.py

@@ -17,6 +17,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 See the License for the specific language governing permissions and
 limitations under the License.
 limitations under the License.
 '''
 '''
+
 __all__ = ["Script"]
 __all__ = ["Script"]
 
 
 import sys
 import sys
@@ -25,12 +26,15 @@ import logging
 
 
 from resource_management.core.environment import Environment
 from resource_management.core.environment import Environment
 from resource_management.core.exceptions import Fail
 from resource_management.core.exceptions import Fail
-
+from resource_management.core.resources.packaging import Package
 
 
 class Script():
 class Script():
   """
   """
   Executes a command for custom service. stdout and stderr are written to
   Executes a command for custom service. stdout and stderr are written to
   tmpoutfile and to tmperrfile respectively.
   tmpoutfile and to tmperrfile respectively.
+  Script instances share configuration as a class parameter and therefore
+  even different Script instances can not be used from different threads at
+  the same time
   """
   """
 
 
   def execute(self):
   def execute(self):
@@ -81,8 +85,43 @@ class Script():
       
       
   @staticmethod
   @staticmethod
   def get_config():
   def get_config():
+    """
+    HACK. Uses static field to store configuration. This is a workaround for
+    "circular dependency" issue when importing params.py file and passing to
+     it a configuration instance.
+    """
     return Script.config
     return Script.config
 
 
+
+  def install(self, env):
+    """
+    Default implementation of install command is to install all packages
+    from a list, received from the server.
+    Feel free to override install() method with your implementation. It
+    usually makes sense to call install_packages() manually in this case
+    """
+    self.install_packages(env)
+
+
+  def install_packages(self, env):
+    """
+    List of packages that are required by service is received from the server
+    as a command parameter. The method installs all packages
+    from this list
+    """
+    config = self.get_config()
+    try:
+      package_list_str = config['hostLevelParams']['package_list']
+      if isinstance(package_list_str,basestring) and len(package_list_str) > 0:
+        package_list = json.loads(package_list_str)
+        for package in package_list:
+          name = package['name']
+          Package(name)
+    except KeyError:
+      pass # No reason to worry
+
+
+
   def fail_with_error(self, message):
   def fail_with_error(self, message):
     """
     """
     Prints error message and exits with non-zero exit code
     Prints error message and exits with non-zero exit code
@@ -128,4 +167,4 @@ class ConfigDictionary(dict):
         except (ValueError, TypeError):
         except (ValueError, TypeError):
           pass
           pass
     
     
-    return value
+    return value

+ 90 - 0
ambari-agent/src/test/python/TestScript.py

@@ -0,0 +1,90 @@
+#!/usr/bin/env python2.6
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+import ConfigParser
+import os
+
+import pprint
+
+from unittest import TestCase
+import threading
+import tempfile
+import time
+from threading import Thread
+
+
+import StringIO
+import sys, logging, pprint
+from ambari_agent import AgentException
+from resource_management.libraries.script import Script
+from resource_management.core.environment import Environment
+from mock.mock import MagicMock, patch
+
+class TestScript(TestCase):
+
+  def setUp(self):
+    # disable stdout
+    out = StringIO.StringIO()
+    sys.stdout = out
+
+
+
+  @patch("resource_management.core.providers.package.PackageProvider")
+  def test_install_packages(self, package_provider_mock):
+    no_such_entry_config = {
+    }
+    empty_config = {
+      'hostLevelParams' : {
+        'package_list' : ''
+      }
+    }
+    dummy_config = {
+      'hostLevelParams' : {
+        'package_list' : "[{\"type\":\"rpm\",\"name\":\"hbase\"},"
+                         "{\"type\":\"rpm\",\"name\":\"yet-another-package\"}]"
+      }
+    }
+
+    # Testing config without any keys
+    with Environment(".") as env:
+      script = Script()
+      Script.config = no_such_entry_config
+      script.install_packages(env)
+    self.assertEquals(len(env.resource_list), 0)
+
+    # Testing empty package list
+    with Environment(".") as env:
+      script = Script()
+      Script.config = empty_config
+      script.install_packages(env)
+    self.assertEquals(len(env.resource_list), 0)
+
+    # Testing installing of a list of packages
+    with Environment(".") as env:
+      Script.config = dummy_config
+      script.install_packages("env")
+    resource_dump = pprint.pformat(env.resource_list)
+    self.assertEqual(resource_dump, "[Package['hbase'], Package['yet-another-package']]")
+
+
+  def tearDown(self):
+    # enable stdout
+    sys.stdout = sys.__stdout__
+
+

+ 21 - 0
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/__init__.py

@@ -0,0 +1,21 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""

+ 23 - 1
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/functions.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 import os
 import os
 import re
 import re
 import math
 import math
@@ -44,4 +66,4 @@ def get_kinit_path(pathes_list):
       kinit_path = path
       kinit_path = path
       break
       break
     
     
-  return kinit_path
+  return kinit_path

+ 23 - 1
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management import *
 from resource_management import *
 import sys
 import sys
 
 
@@ -68,4 +90,4 @@ def hbase_TemplateConfig(name,
   TemplateConfig( format("{conf_dir}/{name}"),
   TemplateConfig( format("{conf_dir}/{name}"),
       owner = params.hbase_user,
       owner = params.hbase_user,
       template_tag = tag
       template_tag = tag
-  )
+  )

+ 23 - 1
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_client.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 import sys
 import sys
 from resource_management import *
 from resource_management import *
 
 
@@ -6,7 +28,7 @@ from hbase import hbase
          
          
 class HbaseClient(Script):
 class HbaseClient(Script):
   def install(self, env):
   def install(self, env):
-    Package('hbase')
+    self.install_packages(env)
     self.configure(env)
     self.configure(env)
     
     
   def configure(self, env):
   def configure(self, env):

+ 23 - 1
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_master.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 import sys
 import sys
 from resource_management import *
 from resource_management import *
 
 
@@ -7,7 +29,7 @@ from hbase_service import hbase_service
          
          
 class HbaseMaster(Script):
 class HbaseMaster(Script):
   def install(self, env):
   def install(self, env):
-    Package('hbase')
+    self.install_packages(env)
     self.configure(env)
     self.configure(env)
     
     
   def configure(self, env):
   def configure(self, env):

+ 23 - 1
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_regionserver.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 import sys
 import sys
 from resource_management import *
 from resource_management import *
 
 
@@ -7,7 +29,7 @@ from hbase_service import hbase_service
          
          
 class HbaseRegionServer(Script):
 class HbaseRegionServer(Script):
   def install(self, env):
   def install(self, env):
-    Package('hbase')
+    self.install_packages(env)
     self.configure(env)
     self.configure(env)
     
     
   def configure(self, env):
   def configure(self, env):

+ 24 - 2
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_service.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management import *
 from resource_management import *
 
 
 def hbase_service(
 def hbase_service(
@@ -19,8 +41,8 @@ def hbase_service(
     elif action == 'stop':
     elif action == 'stop':
       daemon_cmd = format("{cmd} stop {role} && rm -f {pid_file}")
       daemon_cmd = format("{cmd} stop {role} && rm -f {pid_file}")
   
   
-    if daemon_cmd != None: 
+    if daemon_cmd is not None:
       Execute ( daemon_cmd,
       Execute ( daemon_cmd,
         not_if = no_op_test,
         not_if = no_op_test,
         user = params.hbase_user
         user = params.hbase_user
-      )
+      )

+ 23 - 1
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/params.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management import *
 from resource_management import *
 import functions
 import functions
 
 
@@ -60,4 +82,4 @@ hbase_user_keytab = default('hbase_user_keytab')
 kinit_path_local = functions.get_kinit_path([default('kinit_path_local'),"/usr/bin", "/usr/kerberos/bin", "/usr/sbin"])
 kinit_path_local = functions.get_kinit_path([default('kinit_path_local'),"/usr/bin", "/usr/kerberos/bin", "/usr/sbin"])
 
 
 # fix exeuteHadoop calls for secured cluster
 # fix exeuteHadoop calls for secured cluster
-# to string template...
+# to string template...

+ 22 - 0
ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/service_check.py

@@ -1,3 +1,25 @@
+#!/usr/bin/env python2.6
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+Ambari Agent
+
+"""
+
 from resource_management import *
 from resource_management import *
 import functions
 import functions