You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dm...@apache.org on 2013/10/22 18:14:09 UTC
git commit: AMBARI-3560. Add 'path' attribute to Execute() resource
(Andrew Onischuk via dlysnichenko)
Updated Branches:
refs/heads/trunk 08f3991b0 -> bf46889d3
AMBARI-3560. Add 'path' attribute to Execute() resource (Andrew Onischuk via dlysnichenko)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/bf46889d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/bf46889d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/bf46889d
Branch: refs/heads/trunk
Commit: bf46889d35caccf52598064c7d96d6e533347b34
Parents: 08f3991
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Tue Oct 22 19:13:24 2013 +0300
Committer: Lisnichenko Dmitro <dl...@hortonworks.com>
Committed: Tue Oct 22 19:13:24 2013 +0300
----------------------------------------------------------------------
.../src/main/python/resource_management/providers/system.py | 5 ++++-
.../src/main/python/resource_management/resources/system.py | 5 +++--
2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/bf46889d/ambari-agent/src/main/python/resource_management/providers/system.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/providers/system.py b/ambari-agent/src/main/python/resource_management/providers/system.py
index c97211d..d9845a4 100644
--- a/ambari-agent/src/main/python/resource_management/providers/system.py
+++ b/ambari-agent/src/main/python/resource_management/providers/system.py
@@ -183,13 +183,16 @@ class ExecuteProvider(Provider):
return
self.log.info("Executing %s" % self.resource)
+
+ if self.resource.path:
+ self.resource.environment['PATH'] = ":".join(self.resource.path)
ret, out = shell.checked_call(self.resource.command,
cwd=self.resource.cwd, env=self.resource.environment,
preexec_fn=_preexec_fn(self.resource))
self.resource.updated()
-
+
class ScriptProvider(Provider):
def action_run(self):
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/bf46889d/ambari-agent/src/main/python/resource_management/resources/system.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/resource_management/resources/system.py b/ambari-agent/src/main/python/resource_management/resources/system.py
index 729b351..21d66e0 100644
--- a/ambari-agent/src/main/python/resource_management/resources/system.py
+++ b/ambari-agent/src/main/python/resource_management/resources/system.py
@@ -50,12 +50,13 @@ class Execute(Resource):
creates = ResourceArgument()
cwd = ResourceArgument()
- environment = ResourceArgument()
+ # this runs command with a specific env variables, env={'JAVA_HOME': '/usr/jdk'}
+ environment = ResourceArgument(default={})
user = ResourceArgument()
group = ResourceArgument()
returns = ForcedListArgument(default=0)
timeout = ResourceArgument()
-
+ path = ForcedListArgument(default=None)
actions = Resource.actions + ["run"]