more changes to python_agent puppet module

Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/b20aaf8b
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/b20aaf8b
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/b20aaf8b

Branch: refs/heads/master
Commit: b20aaf8b9e6b799ee3cdf74dd0370bdda700a052
Parents: 2fe68c3
Author: lasinducharith <[email protected]>
Authored: Sun Nov 9 14:59:42 2014 +0530
Committer: lasinducharith <[email protected]>
Committed: Sun Nov 9 14:59:42 2014 +0530

----------------------------------------------------------------------
 .../puppet3/modules/python_agent/manifests/init.pp  | 16 ++++++++++++----
 .../modules/python_agent/manifests/initialize.pp    |  4 ++--
 .../puppet3/modules/python_agent/manifests/start.pp |  2 +-
 3 files changed, 15 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/b20aaf8b/tools/puppet3/modules/python_agent/manifests/init.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/python_agent/manifests/init.pp 
b/tools/puppet3/modules/python_agent/manifests/init.pp
index bd3ae90..23977b3 100644
--- a/tools/puppet3/modules/python_agent/manifests/init.pp
+++ b/tools/puppet3/modules/python_agent/manifests/init.pp
@@ -38,6 +38,13 @@ class python_agent(
   $mb_ip = $split_mburl[0]
   $mb_port = $split_mburl[1]
 
+#  $split_mburl = split($mb_url, "//")
+#  $split_mburl = split($split_mburl[1], ":")
+#  $mb_ip = $split_mburl[0]
+#  $mb_port = $split_mburl[1]
+#  $mb_ip = '127.0.0.1'
+#  $mb_port = '1883'
+
   tag($service_code)
 
   $default_templates = [
@@ -74,7 +81,8 @@ class python_agent(
 
   exec { 'make extension folder':
     path    => '/bin/',
-    command => "mkdir -p ${target}/${service_code}/extensions",
+    command => "mkdir -p ${agent_home}/extensions",
+    #command => "mkdir -p ${target}/${service_code}/extensions",
     require => Python_agent::Initialize[$service_code];
   }
 
@@ -93,7 +101,7 @@ class python_agent(
     $service_templates:
       target    => $agent_home,
       template_dir => "agent",
-      require   => Python_agent::Initialize[$service_code];
+      require   => Exec['make extension folder'];
   }
 
 # applying custom extensions
@@ -102,8 +110,8 @@ class python_agent(
       $custom_templates:
         target    => $agent_home,
         template_dir => "${module}/agent",
-        require   => [Python_agent::Initialize[$service_code]]
-    }
+        require   => [Exec['make extension folder']]
+       }
   }
 
 # removing default extensions which are shipped by agent.zip

http://git-wip-us.apache.org/repos/asf/stratos/blob/b20aaf8b/tools/puppet3/modules/python_agent/manifests/initialize.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/python_agent/manifests/initialize.pp 
b/tools/puppet3/modules/python_agent/manifests/initialize.pp
index 73a2c5a..299ba47 100755
--- a/tools/puppet3/modules/python_agent/manifests/initialize.pp
+++ b/tools/puppet3/modules/python_agent/manifests/initialize.pp
@@ -62,7 +62,7 @@ define python_agent::initialize ($repo, $version, 
$agent_name, $local_dir, $targ
   exec {
     "creating_target_for_python_${name}":
       path    => 
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
-      command => "mkdir -p ${target}",
+      command => "mkdir -p ${target}/${agent_name}",
       require => Exec["pip installs-pexpect"];
 
     "creating_local_package_repo_for_python_${name}":
@@ -82,7 +82,7 @@ define python_agent::initialize ($repo, $version, 
$agent_name, $local_dir, $targ
   exec {
     "extracting_${agent_name}.zip_for_${name}":
       path      => 
'/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin',
-      cwd       => $target,
+      cwd       => "$target/${agent_name}",
       #/mnt/apache-stratos-python-cartridge-agent-1.0.0/agent.py
       unless    => "test -d ${target}/${agent_name}/agent.conf",
       command   => "unzip -o ${local_dir}/${agent_name}.zip",

http://git-wip-us.apache.org/repos/asf/stratos/blob/b20aaf8b/tools/puppet3/modules/python_agent/manifests/start.pp
----------------------------------------------------------------------
diff --git a/tools/puppet3/modules/python_agent/manifests/start.pp 
b/tools/puppet3/modules/python_agent/manifests/start.pp
index 61c3f97..f76d520 100755
--- a/tools/puppet3/modules/python_agent/manifests/start.pp
+++ b/tools/puppet3/modules/python_agent/manifests/start.pp
@@ -22,6 +22,6 @@ define python_agent::start ($target, $owner) {
     user    => $owner,
     path    => '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:',
     cwd     => "${target}/",
-    command => "python agent.py &",
+    command => "python agent.py > /tmp/agent.screen.log 2>&1 &",
   }
 }

Reply via email to