Updated Branches:
refs/heads/trunk d01e0e26a -> 1d1e49ce9
AMBARI-3798. Add to base script separate method to install packages needed by service (Dmitry Lysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/1d1e49ce
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/1d1e49ce
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/1d1e49ce
Branch: refs/heads/trunk
Commit: 1d1e49ce9dd9ded4dc1040cab91d9331fe0e6848
Parents: d01e0e2
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Mon Nov 18 22:06:47 2013 +0200
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Mon Nov 18 22:06:47 2013 +0200
----------------------------------------------------------------------
.../ambari_agent/CustomServiceOrchestrator.py | 2 +-
.../main/python/resource_management/__init__.py | 22 +++++
.../python/resource_management/core/__init__.py | 22 +++++
.../python/resource_management/core/base.py | 22 ++++-
.../resource_management/core/environment.py | 24 +++++-
.../resource_management/core/exceptions.py | 22 +++++
.../core/providers/__init__.py | 22 +++++
.../core/providers/accounts.py | 22 +++++
.../resource_management/core/providers/mount.py | 22 +++++
.../core/providers/package/__init__.py | 22 +++++
.../core/providers/package/yumrpm.py | 22 +++++
.../core/providers/package/zypper.py | 22 +++++
.../core/providers/service.py | 22 +++++
.../core/providers/system.py | 22 +++++
.../python/resource_management/core/shell.py | 24 +++++-
.../python/resource_management/core/source.py | 22 +++++
.../python/resource_management/core/system.py | 22 +++++
.../python/resource_management/core/utils.py | 24 +++++-
.../resource_management/libraries/__init__.py | 24 +++++-
.../libraries/functions/__init__.py | 22 +++++
.../libraries/functions/default.py | 24 +++++-
.../libraries/functions/format.py | 24 +++++-
.../libraries/providers/__init__.py | 24 +++++-
.../libraries/providers/execute_hadoop.py | 24 +++++-
.../libraries/providers/template_config.py | 24 +++++-
.../libraries/providers/xml_config.py | 24 +++++-
.../libraries/resources/__init__.py | 22 +++++
.../libraries/resources/execute_hadoop.py | 24 +++++-
.../libraries/resources/template_config.py | 24 +++++-
.../libraries/resources/xml_config.py | 24 +++++-
.../libraries/script/__init__.py | 22 +++++
.../libraries/script/script.py | 43 +++++++++-
ambari-agent/src/test/python/TestScript.py | 90 ++++++++++++++++++++
.../services/HBASE/package/scripts/__init__.py | 21 +++++
.../services/HBASE/package/scripts/functions.py | 24 +++++-
.../services/HBASE/package/scripts/hbase.py | 24 +++++-
.../HBASE/package/scripts/hbase_client.py | 24 +++++-
.../HBASE/package/scripts/hbase_master.py | 24 +++++-
.../HBASE/package/scripts/hbase_regionserver.py | 24 +++++-
.../HBASE/package/scripts/hbase_service.py | 26 +++++-
.../services/HBASE/package/scripts/params.py | 24 +++++-
.../HBASE/package/scripts/service_check.py | 22 +++++
42 files changed, 1008 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 2074b35..b568335 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/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))
# 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:
- content = json.dumps(command)
+ content = json.dumps(command, sort_keys = False, indent = 4)
f.write(content)
return file_path
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/__init__.py b/ambari-agent/src/main/python/resource_management/__init__.py
index afcd019..8629c3a 100644
--- a/ambari-agent/src/main/python/resource_management/__init__.py
+++ b/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.core import *
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/__init__.py b/ambari-agent/src/main/python/resource_management/core/__init__.py
index bcf9ea8..4bb1c8e 100644
--- a/ambari-agent/src/main/python/resource_management/core/__init__.py
+++ b/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.environment import *
from resource_management.core.exceptions import *
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/base.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/base.py b/ambari-agent/src/main/python/resource_management/core/base.py
index 0ad34ce..70197a2 100644
--- a/ambari-agent/src/main/python/resource_management/core/base.py
+++ b/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",
"BooleanArgument"]
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/environment.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/environment.py b/ambari-agent/src/main/python/resource_management/core/environment.py
index 025c17e..59b9de3 100644
--- a/ambari-agent/src/main/python/resource_management/core/environment.py
+++ b/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"]
@@ -184,4 +204,4 @@ class Environment(object):
self.config = state['config']
self.resources = state['resources']
self.resource_list = state['resource_list']
- self.delayed_actions = state['delayed_actions']
\ No newline at end of file
+ self.delayed_actions = state['delayed_actions']
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/exceptions.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/exceptions.py b/ambari-agent/src/main/python/resource_management/core/exceptions.py
index 26cd3a2..dbeb265 100644
--- a/ambari-agent/src/main/python/resource_management/core/exceptions.py
+++ b/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):
pass
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/providers/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/__init__.py b/ambari-agent/src/main/python/resource_management/core/providers/__init__.py
index 74ae93a..3946aac 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/__init__.py
+++ b/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"]
import logging
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/providers/accounts.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/accounts.py b/ambari-agent/src/main/python/resource_management/core/providers/accounts.py
index 583e6c3..a0b26b0 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/accounts.py
+++ b/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
import grp
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/providers/mount.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/mount.py b/ambari-agent/src/main/python/resource_management/core/providers/mount.py
index 446bba0..c5e854c 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/mount.py
+++ b/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
import os
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/providers/package/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/package/__init__.py b/ambari-agent/src/main/python/resource_management/core/providers/package/__init__.py
index e862cd1..84e5030 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/package/__init__.py
+++ b/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.providers import Provider
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/providers/package/yumrpm.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/package/yumrpm.py b/ambari-agent/src/main/python/resource_management/core/providers/package/yumrpm.py
index 0758fb4..73724bd 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/package/yumrpm.py
+++ b/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 import shell
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/providers/package/zypper.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/package/zypper.py b/ambari-agent/src/main/python/resource_management/core/providers/package/zypper.py
index 0099a65..acc15f1 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/package/zypper.py
+++ b/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 import shell
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/providers/service.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/service.py b/ambari-agent/src/main/python/resource_management/core/providers/service.py
index 17740f9..8ec7643 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/service.py
+++ b/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
from resource_management.core import shell
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/providers/system.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/providers/system.py b/ambari-agent/src/main/python/resource_management/core/providers/system.py
index 378e0e1..8ad6c5f 100644
--- a/ambari-agent/src/main/python/resource_management/core/providers/system.py
+++ b/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
import grp
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/shell.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/shell.py b/ambari-agent/src/main/python/resource_management/core/shell.py
index 8e3f221..3c244b5 100644
--- a/ambari-agent/src/main/python/resource_management/core/shell.py
+++ b/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"]
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)
raise Fail(err_msg)
- return code, out
\ No newline at end of file
+ return code, out
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/source.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/source.py b/ambari-agent/src/main/python/resource_management/core/source.py
index cb11bbc..369b84c 100644
--- a/ambari-agent/src/main/python/resource_management/core/source.py
+++ b/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 resource_management.core.environment import Environment
from resource_management.core.utils import checked_unite
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/system.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/system.py b/ambari-agent/src/main/python/resource_management/core/system.py
index 5239186..296dc04 100644
--- a/ambari-agent/src/main/python/resource_management/core/system.py
+++ b/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"]
import os
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/core/utils.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/core/utils.py b/ambari-agent/src/main/python/resource_management/core/utils.py
index af8dbb2..b8606a7 100644
--- a/ambari-agent/src/main/python/resource_management/core/utils.py
+++ b/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
class AttributeDictionary(object):
@@ -80,4 +102,4 @@ def checked_unite(dict1, dict2):
result = dict1.copy()
result.update(dict2)
- return result
\ No newline at end of file
+ return result
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/__init__.py b/ambari-agent/src/main/python/resource_management/libraries/__init__.py
index d73c299..5f74cc6 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/__init__.py
+++ b/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.resources import *
from resource_management.libraries.providers import *
-from resource_management.libraries.script import *
\ No newline at end of file
+from resource_management.libraries.script import *
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/functions/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/functions/__init__.py b/ambari-agent/src/main/python/resource_management/libraries/functions/__init__.py
index 7611c4e..122ff77 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/functions/__init__.py
+++ b/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.format import *
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/functions/default.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/functions/default.py b/ambari-agent/src/main/python/resource_management/libraries/functions/default.py
index ab0e19c..80c6585 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/functions/default.py
+++ b/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"]
from resource_management.libraries.script import Script
@@ -16,4 +38,4 @@ def default(name, default_value=None):
else:
return default_value
- return curr_dict
\ No newline at end of file
+ return curr_dict
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/functions/format.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/functions/format.py b/ambari-agent/src/main/python/resource_management/libraries/functions/format.py
index 2465681..e8fb0cf 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/functions/format.py
+++ b/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"]
import sys
from string import Formatter
@@ -21,4 +43,4 @@ def format(format_string, *args, **kwargs):
result = checked_unite(kwargs, variables)
result.pop("self", None) # self kwarg would result in an error
- return ConfigurationFormatter().format(format_string, args, **result)
\ No newline at end of file
+ return ConfigurationFormatter().format(format_string, args, **result)
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/providers/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/providers/__init__.py b/ambari-agent/src/main/python/resource_management/libraries/providers/__init__.py
index 19816c5..81378b8 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/providers/__init__.py
+++ b/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(
redhat=dict(
),
@@ -14,4 +36,4 @@ PROVIDERS = dict(
TemplateConfig="resource_management.libraries.providers.template_config.TemplateConfigProvider",
XmlConfig="resource_management.libraries.providers.xml_config.XmlConfigProvider"
),
-)
\ No newline at end of file
+)
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/providers/execute_hadoop.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/providers/execute_hadoop.py b/ambari-agent/src/main/python/resource_management/libraries/providers/execute_hadoop.py
index 5b384b2..20b985b 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/providers/execute_hadoop.py
+++ b/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
from resource_management import *
@@ -29,4 +51,4 @@ class ExecuteHadoopProvider(Provider):
try_sleep = self.resource.try_sleep,
logoutput = self.resource.logoutput,
)
- env.run()
\ No newline at end of file
+ env.run()
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/providers/template_config.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/providers/template_config.py b/ambari-agent/src/main/python/resource_management/libraries/providers/template_config.py
index 2a58bdb..be22c70 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/providers/template_config.py
+++ b/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
from resource_management import *
@@ -19,4 +41,4 @@ class TemplateConfigProvider(Provider):
mode = self.resource.mode,
content = Template(template_name, extra_imports=self.resource.extra_imports)
)
- env.run()
\ No newline at end of file
+ env.run()
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py b/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py
index 1939ba8..9940ea5 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/providers/xml_config.py
+++ b/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
from resource_management import *
@@ -27,4 +49,4 @@ class XmlConfigProvider(Provider):
group = self.resource.group,
mode = self.resource.mode
)
- env.run()
\ No newline at end of file
+ env.run()
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py b/ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py
index 12f5455..38f731b 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/resources/__init__.py
+++ b/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.template_config import *
from resource_management.libraries.resources.xml_config import *
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py b/ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py
index 3f1e357..738f82a 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/resources/execute_hadoop.py
+++ b/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"]
from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
@@ -18,4 +40,4 @@ class ExecuteHadoop(Resource):
kinit_path_local = ResourceArgument()
actions = Resource.actions + ["run"]
-
\ No newline at end of file
+
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/resources/template_config.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/resources/template_config.py b/ambari-agent/src/main/python/resource_management/libraries/resources/template_config.py
index 880806c..68efabd 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/resources/template_config.py
+++ b/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"]
from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
@@ -10,4 +32,4 @@ class TemplateConfig(Resource):
template_tag = ResourceArgument()
extra_imports = ResourceArgument(default=[])
- actions = Resource.actions + ["create"]
\ No newline at end of file
+ actions = Resource.actions + ["create"]
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/resources/xml_config.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/resources/xml_config.py b/ambari-agent/src/main/python/resource_management/libraries/resources/xml_config.py
index 036329c..6840348 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/resources/xml_config.py
+++ b/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"]
from resource_management.core.base import Resource, ForcedListArgument, ResourceArgument, BooleanArgument
@@ -12,4 +34,4 @@ class XmlConfig(Resource):
owner = ResourceArgument()
group = ResourceArgument()
- actions = Resource.actions + ["create"]
\ No newline at end of file
+ actions = Resource.actions + ["create"]
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/script/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/script/__init__.py b/ambari-agent/src/main/python/resource_management/libraries/script/__init__.py
index dae703b..2d2f6d3 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/script/__init__.py
+++ b/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 *
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/libraries/script/script.py b/ambari-agent/src/main/python/resource_management/libraries/script/script.py
index 689cd63..9c37d32 100644
--- a/ambari-agent/src/main/python/resource_management/libraries/script/script.py
+++ b/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
limitations under the License.
'''
+
__all__ = ["Script"]
import sys
@@ -25,12 +26,15 @@ import logging
from resource_management.core.environment import Environment
from resource_management.core.exceptions import Fail
-
+from resource_management.core.resources.packaging import Package
class Script():
"""
Executes a command for custom service. stdout and stderr are written to
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):
@@ -81,8 +85,43 @@ class Script():
@staticmethod
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
+
+ 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):
"""
Prints error message and exits with non-zero exit code
@@ -128,4 +167,4 @@ class ConfigDictionary(dict):
except (ValueError, TypeError):
pass
- return value
\ No newline at end of file
+ return value
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-agent/src/test/python/TestScript.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/TestScript.py b/ambari-agent/src/test/python/TestScript.py
new file mode 100644
index 0000000..e4fc24c
--- /dev/null
+++ b/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__
+
+
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/__init__.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/__init__.py
index e69de29..b80fda6 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/__init__.py
+++ b/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
+
+"""
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/functions.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/functions.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/functions.py
index 892f6ef..e508679 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/functions.py
+++ b/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 re
import math
@@ -44,4 +66,4 @@ def get_kinit_path(pathes_list):
kinit_path = path
break
- return kinit_path
\ No newline at end of file
+ return kinit_path
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase.py
index e19825a..3abe532 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase.py
+++ b/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 *
import sys
@@ -68,4 +90,4 @@ def hbase_TemplateConfig(name,
TemplateConfig( format("{conf_dir}/{name}"),
owner = params.hbase_user,
template_tag = tag
- )
\ No newline at end of file
+ )
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_client.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_client.py
index bfd090a..9464555 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_client.py
+++ b/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
from resource_management import *
@@ -6,7 +28,7 @@ from hbase import hbase
class HbaseClient(Script):
def install(self, env):
- Package('hbase')
+ self.install_packages(env)
self.configure(env)
def configure(self, env):
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_master.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_master.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_master.py
index 1a1a4ea..b139d47 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_master.py
+++ b/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
from resource_management import *
@@ -7,7 +29,7 @@ from hbase_service import hbase_service
class HbaseMaster(Script):
def install(self, env):
- Package('hbase')
+ self.install_packages(env)
self.configure(env)
def configure(self, env):
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_regionserver.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_regionserver.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_regionserver.py
index 757f376..559a85f 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_regionserver.py
+++ b/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
from resource_management import *
@@ -7,7 +29,7 @@ from hbase_service import hbase_service
class HbaseRegionServer(Script):
def install(self, env):
- Package('hbase')
+ self.install_packages(env)
self.configure(env)
def configure(self, env):
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_service.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_service.py
index d8f359f..66fcea1 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/hbase_service.py
+++ b/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 *
def hbase_service(
@@ -19,8 +41,8 @@ def hbase_service(
elif action == 'stop':
daemon_cmd = format("{cmd} stop {role} && rm -f {pid_file}")
- if daemon_cmd != None:
+ if daemon_cmd is not None:
Execute ( daemon_cmd,
not_if = no_op_test,
user = params.hbase_user
- )
\ No newline at end of file
+ )
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/params.py
index 83ff30f..b1988d4 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/params.py
+++ b/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 *
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"])
# fix exeuteHadoop calls for secured cluster
-# to string template...
\ No newline at end of file
+# to string template...
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/1d1e49ce/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/service_check.py b/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/service_check.py
index 0675d98..59a81aa 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0._/services/HBASE/package/scripts/service_check.py
+++ b/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 *
import functions