add puppet manifests for rubbos client module 85/11985/2
authorwangyaoguang <sunshine.wang@huawei.com>
Thu, 7 Apr 2016 11:29:38 +0000 (19:29 +0800)
committerwangyaoguang <sunshine.wang@huawei.com>
Fri, 8 Apr 2016 01:00:30 +0000 (09:00 +0800)
1. add  manifests fro rubbos client module
2. add client configuration files
3. modify some related common parameters

JIRA: BOTTLENECK-55

Change-Id: Ia87090687217bdfe82ae89f7e497f0a665a83201
Signed-off-by: wangyaoguang <sunshine.wang@huawei.com>
testsuites/rubbos/puppet_manifests/modules/params/manifests/rubbos_params.pp
testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/Makefile [new file with mode: 0755]
testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/build.properties [new file with mode: 0644]
testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/config.mk [new file with mode: 0644]
testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/rubbos.properties.template [new file with mode: 0644]
testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/run_emulator.sh [new file with mode: 0755]
testsuites/rubbos/puppet_manifests/modules/rubbos_client/manifests/rubbos_client_off.pp [new file with mode: 0644]
testsuites/rubbos/puppet_manifests/modules/rubbos_client/manifests/rubbos_client_on.pp [new file with mode: 0644]
testsuites/rubbos/puppet_manifests/modules/rubbos_monitor/manifests/rubbos_monitor_off.pp
testsuites/rubbos/puppet_manifests/modules/rubbos_monitor/manifests/rubbos_monitor_on.pp

index 9595143..b907231 100644 (file)
@@ -17,5 +17,7 @@ class params::rubbos_params {
   $mysql_user_group     = "mysql"
   $mysql_user_name      = "mysql"
   $mysql_user_password  = "mysql"
+  $rubbos_os_username   = "ubuntu"
+  $rubbos_os_usergroup  = "ubuntu"
 
 }
diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/Makefile b/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/Makefile
new file mode 100755 (executable)
index 0000000..77dec80
--- /dev/null
@@ -0,0 +1,86 @@
+#############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+###########################
+#    RUBBoS Makefile      #
+###########################
+
+include config.mk
+
+##############################
+#    Environment variables   #
+##############################
+
+JAVA  = $(JAVA_HOME)/bin/java
+JAVAC = $(JAVA_HOME)/bin/javac
+JAVACOPTS = -deprecation
+JAVACC = $(JAVAC) $(JAVACOPTS)
+RMIC = $(JAVA_HOME)/bin/rmic
+RMIREGISTRY= $(JAVA_HOME)/bin/rmiregistry
+CLASSPATH = .:$(J2EE_HOME)/lib/j2ee.jar:$(JAVA_HOME)/jre/lib/rt.jar
+JAVADOC = $(JAVA_HOME)/javadoc
+
+
+#########################
+#    Servlets version   #
+#########################
+#ServletPrinter
+Servlets = Config TimeManagement BrowseCategories Auth RegisterUser RubbosHttpServlet BrowseRegions SearchItemsByCategory SearchItemsByRegion ViewItem ViewBidHistory ViewUserInfo SellItemForm RegisterItem PutCommentAuth PutComment StoreComment BuyNowAuth BuyNow StoreBuyNow PutBidAuth PutBid StoreBid AboutMe
+
+all_servlets_sources =  $(addprefix edu/rice/rubbos/servlets/, $(addsuffix .java, $(Servlets)))
+all_servlets_obj = $(addprefix edu/rice/rubbos/servlets/, $(addsuffix .class, $(Servlets)))
+
+servlets: $(all_servlets_obj)
+
+clean_servlets:
+       rm -f edu/rice/rubbos/servlets/*.class
+
+####################
+#       Client     #
+####################
+
+ClientFiles = URLGenerator URLGeneratorPHP RUBBoSProperties Stats \
+             TransitionTable ClientEmulator UserSession
+
+all_client_sources =  $(addprefix edu/rice/rubbos/client/, $(addsuffix .java, $(ClientFiles)))
+all_client_obj = $(addprefix edu/rice/rubbos/client/, $(addsuffix .class, $(ClientFiles))) edu/rice/rubbos/beans/TimeManagement.class
+
+client: $(all_client_obj)
+
+initDB:
+       ${JAVA} -classpath .:./database edu.rice.rubbos.client.InitDB ${PARAM}
+
+emulator:
+       ${JAVA} -classpath Client:Client/rubbos_client.jar:. -Xms256m -Xmx2048m -Dhttp.keepAlive=true -Dhttp.maxConnections=1000000 edu.rice.rubbos.client.ClientEmulator
+
+emulatorDebug:
+       ${JAVA} -classpath Client:Client/rubbos_client.jar:. -Xdebug -Xrunjdwp:transport=dt_socket,address=8000,server=y,suspend=n -Xms128m -Xmx1024m -Dhttp.keepAlive=true -Dhttp.maxConnections=1000000 edu.rice.rubbos.client.ClientEmulator
+
+
+############################
+#       Global rules       #
+############################
+
+
+all: beans ejb_servlets client javadoc flush_cache
+
+world: all servlets
+
+javadoc :
+       ${JAVADOC} -d ./doc/api -bootclasspath ${CLASSPATH} -version -author -windowtitle "RUBBoS API" -header "<b>RUBBoS (C)2001 Rice University/INRIA</b><br>" edu.rice.rubbos.beans edu.rice.rubbos.beans.servlets edu.rice.rubbos.client
+
+clean:
+       rm -f core edu/rice/rubbos/beans/*.class edu/rice/rubbos/beans/JOnAS* edu/rice/rubbos/beans/servlets/*.class edu/rice/rubbos/client/*.class edu/rice/rubbos/servlets/*.class
+
+%.class: %.java
+       ${JAVACC} -classpath ${CLASSPATH} $<
+
+flush_cache: bench/flush_cache.c
+       gcc bench/flush_cache.c -o bench/flush_cache
diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/build.properties b/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/build.properties
new file mode 100644 (file)
index 0000000..77de8ba
--- /dev/null
@@ -0,0 +1,16 @@
+#############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+src = .
+dist =.
+classes.dir = ./build
+web.dir = ../Servlet_HTML
+
+j2ee = REPLACED_RUBBOS_APP_TOOLS/j2sdkee1.3.1
diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/config.mk b/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/config.mk
new file mode 100644 (file)
index 0000000..407bc25
--- /dev/null
@@ -0,0 +1,36 @@
+#############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+## Environment variables
+JAVA  = $(JAVA_HOME)/bin/java
+JAVAC = $(JAVA_HOME)/bin/javac
+JAVACOPTS = -deprecation
+JAVACC = $(JAVAC) $(JAVACOPTS)
+RMIC = $(JAVA_HOME)/bin/rmic
+RMIREGISTRY= $(JAVA_HOME)/bin/rmiregistry
+CLASSPATH = .:$(J2EE_HOME)/lib/j2ee.jar:$(JAVA_HOME)/jre/lib/rt.jar:$(CATALINA_HOME)/common/lib/servlet-api.jar
+JAVADOC = $(JAVA_HOME)/bin/javadoc
+JAR = $(JAVA_HOME)/bin/jar
+
+GENIC = ${JONAS_ROOT}/bin/unix/GenIC
+
+MAKE = gmake
+CP = /bin/cp
+RM = /bin/rm
+MKDIR = /bin/mkdir
+
+
+# EJB server: supported values are jonas or jboss
+EJB_SERVER = jonas
+
+# DB server: supported values are MySQL or PostgreSQL
+DB_SERVER = MySQL
+
+%.class: %.java
+       ${JAVACC} -classpath ${CLASSPATH} $<
diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/rubbos.properties.template b/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/rubbos.properties.template
new file mode 100644 (file)
index 0000000..33aa46e
--- /dev/null
@@ -0,0 +1,85 @@
+#############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+# HTTP server information
+httpd_hostname = REPLACED_WEB_SERVER
+httpd_port = 8000
+
+# C/JDBC server to monitor (if any)
+cjdbc_hostname =
+
+# Precise which version to use. Valid options are : PHP, Servlets, EJB
+httpd_use_version = Servlets
+
+# EJB server information
+ejb_server =
+ejb_html_path =
+ejb_script_path =
+
+# Servlets server information
+servlets_server = REPLACED_APPLICATION_SERVER
+servlets_html_path = /rubbos
+servlets_script_path = /rubbos/servlet
+
+# PHP information
+php_html_path = /PHP
+php_script_path = /PHP
+
+#Database information
+database_master_server = REPLACED_DB_SERVER
+
+database_slave_servers =
+workload_remote_client_nodes = REPLACED_CLIENT_SERVERS
+workload_remote_client_command = REPLACED_RUBBOS_APP_TOOLS/jdk1.6.0_27/bin/java -classpath .:REPLACED_RUBBOS_HOME/Client/:REPLACED_RUBBOS_HOME/Client/rubbos_client.jar -Xms512m -Xmx2048m -Dhttp.keepAlive=true -Dhttp.maxConnections=1000000 edu.rice.rubbos.client.ClientEmulator
+
+workload_number_of_clients_per_node = REPLACED_NUMBER_OF_CLIENTS_PER_NODE
+
+# Workload: precise which transition table to use
+workload_user_transition_table = REPLACED_RUBBOS_HOME/workload/user_transitions.txt
+workload_author_transition_table = REPLACED_RUBBOS_HOME/workload/author_transitions.txt
+workload_number_of_columns = 24
+workload_number_of_rows = 26
+workload_maximum_number_of_transitions = 1000
+workload_use_tpcw_think_time = yes
+workload_number_of_stories_per_page = 20
+
+workload_up_ramp_time_in_ms = 15000
+workload_up_ramp_slowdown_factor = 2
+
+workload_session_run_time_in_ms = 60000
+
+workload_down_ramp_time_in_ms = 10000
+workload_down_ramp_slowdown_factor = 3
+workload_percentage_of_author = 10
+
+# Users policy
+database_number_of_authors = 50
+database_number_of_users = 500000
+
+# Stories policy
+database_story_dictionnary = REPLACED_RUBBOS_HOME/database/dictionary
+database_story_maximum_length = 1024
+database_oldest_story_year = 1998
+database_oldest_story_month = 1
+
+# Comments policy
+database_comment_max_length = 1024
+
+# Connection timedout settings
+connection_time_out_interval = 300
+
+# Monitoring Information
+monitoring_debug_level = 1
+monitoring_program = REPLACED_RUBBOS_APP/sysstat-9.0.6/bin/sar
+monitoring_options = -u ALL -I SUM
+monitoring_sampling_in_seconds = 1
+monitoring_rsh = /usr/bin/ssh
+monitoring_scp = /usr/bin/scp
+monitoring_gnuplot_terminal = png
diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/run_emulator.sh b/testsuites/rubbos/puppet_manifests/modules/rubbos_client/files/run_emulator.sh
new file mode 100755 (executable)
index 0000000..5e8a6e9
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+##############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+## Usage: run_emulator.sh
+echo "==> Rubbos emulator start $(date)"
+
+REPLACED_RUBBOS_APP_TOOLS/jdk1.6.0_27/bin/java -classpath .:REPLACED_RUBBOS_HOME/Client:REPLACED_RUBBOS_HOME/Client/rubbos_client.jar -Xms512m -Xmx2048m -Dhttp.keepAlive=true -Dhttp.maxConnections=1000000 edu.rice.rubbos.client.ClientEmulator
+
+echo "==> Rubbos emulator end $(date)"
diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_client/manifests/rubbos_client_off.pp b/testsuites/rubbos/puppet_manifests/modules/rubbos_client/manifests/rubbos_client_off.pp
new file mode 100644 (file)
index 0000000..b1d0b3d
--- /dev/null
@@ -0,0 +1,103 @@
+#############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+class rubbos_client::rubbos_client_off {
+
+  include params::rubbos_params
+
+  # Declare some variables
+  $rubbos_home          = $params::rubbos_params::rubbos_home
+
+  # build.properties
+  file {'${rubbos_home}/build.properties':
+        ensure          => absent,
+        path            => "${rubbos_home}/build.properties",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  # config.mk
+  file {'${rubbos_home}/config.mk':
+        ensure          => absent,
+        path            => "${rubbos_home}/config.mk",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  # Makefile
+  file {'${rubbos_home}/Makefile':
+        ensure          => absent,
+        path            => "${rubbos_home}/Makefile",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  # bench/rubbos.properties.template
+  file {'${rubbos_home}/bench/rubbos.properties.template':
+        ensure          => absent,
+        path            => "${rubbos_home}/bench/rubbos.properties.template",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  # bench/run_emulator.sh
+  file {'${rubbos_home}/bench/run_emulator.sh':
+        ensure          => absent,
+        path            => "${rubbos_home}/bench/run_emulator.sh",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  file {'${rubbos_home}/Client.tar.gz':
+      ensure            => absent,
+      path              => "${rubbos_home}/Client.tar.gz",
+      backup            => false,
+  }
+
+  file {'${rubbos_home}/Client':
+        ensure          => absent,
+        path            => "${rubbos_home}/Client",
+        force           => true,
+        recurse         => true,
+        show_diff       => false,
+        backup          => false,
+  }
+
+  file {'${rubbos_home}/workload.tar.gz':
+        ensure          => absent,
+        path            => "${rubbos_home}/workload.tar.gz",
+        backup          => false,
+  }
+
+  file {'${rubbos_home}/workload':
+        ensure          => absent,
+        path            => "${rubbos_home}/workload",
+        force           => true,
+        recurse         => true,
+        show_diff       => false,
+        backup          => false,
+  }
+
+  file {'${rubbos_home}/database.tar.gz':
+        ensure          => absent,
+        path            => "${rubbos_home}/database.tar.gz",
+        backup          => false,
+  }
+
+  file {'${rubbos_home}/database':
+        ensure          => absent,
+        path            => "${rubbos_home}/database",
+        force           => true,
+        recurse         => true,
+        show_diff       => false,
+        backup          => false,
+  }
+
+}
diff --git a/testsuites/rubbos/puppet_manifests/modules/rubbos_client/manifests/rubbos_client_on.pp b/testsuites/rubbos/puppet_manifests/modules/rubbos_client/manifests/rubbos_client_on.pp
new file mode 100644 (file)
index 0000000..9bdf072
--- /dev/null
@@ -0,0 +1,179 @@
+#############################################################################
+# Copyright (c) 2016 Huawei Technologies Co.,Ltd and others.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+
+class rubbos_client::rubbos_client_on {
+
+  include params::rubbos_params
+  require rubbos_common::rubbos_common_on
+  require rubbos_monitor::rubbos_monitor_on
+
+  # Declare some variables
+  $rubbos_app_tools     = $params::rubbos_params::rubbos_app_tools
+  $rubbos_home          = $params::rubbos_params::rubbos_home
+  $rubbos_os_username   = $params::rubbos_params::rubbos_os_username
+  $rubbos_os_usergroup  = $params::rubbos_params::rubbos_os_usergroup
+
+  # Prepare needed tools
+  file {'${rubbos_app_tools}/j2sdkee1.3.1.jar.gz':
+        ensure  => file,
+        path    => "${rubbos_app_tools}/j2sdkee1.3.1.jar.gz",
+        source  => "puppet:///modules/rubbos_common/j2sdkee1.3.1.jar.gz",
+        backup  => false,
+  }
+
+  exec {'tar xzvf ${rubbos_app_tools}/j2sdkee1.3.1.jar.gz':
+        cwd     => "${rubbos_app_tools}",
+        command => "tar xzvf ${rubbos_app_tools}/j2sdkee1.3.1.jar.gz",
+        path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        require => File['${rubbos_app_tools}/j2sdkee1.3.1.jar.gz'],
+  }
+
+  file {'${rubbos_app_tools}/apache-ant-1.6.5.tar.gz':
+        ensure  => file,
+        path    => "${rubbos_app_tools}/apache-ant-1.6.5.tar.gz",
+        source  => "puppet:///modules/rubbos_common/apache-ant-1.6.5.tar.gz",
+        backup  => false,
+  }
+
+  exec {'tar xzvf ${rubbos_app_tools}/apache-ant-1.6.5.tar.gz':
+        cwd     => "${rubbos_app_tools}",
+        command => "tar xzvf ${rubbos_app_tools}/apache-ant-1.6.5.tar.gz",
+        path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        require => File['${rubbos_app_tools}/apache-ant-1.6.5.tar.gz'],
+  }
+
+  # Prepare client codes and files
+  file {'${rubbos_home}/Client.tar.gz':
+       ensure   => file,
+       path     => "${rubbos_home}/Client.tar.gz",
+       source   => "puppet:///modules/rubbos_client/Client.tar.gz",
+       backup   => false,
+  }
+
+  exec {'tar xvzf ${rubbos_home}/Client.tar.gz':
+       cwd      => "${rubbos_home}",
+       command  => "tar xvzf ${rubbos_home}/Client.tar.gz",
+       path     => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+       require  => File['${rubbos_home}/Client.tar.gz'],
+  }
+
+  file {'${rubbos_home}/workload.tar.gz':
+       ensure   => file,
+       path     => "${rubbos_home}/workload.tar.gz",
+       source   => "puppet:///modules/rubbos_client/workload.tar.gz",
+       backup   => false,
+  }
+
+  exec {'tar xvzf ${rubbos_home}/workload.tar.gz':
+       cwd      => "${rubbos_home}",
+       command  => "tar xvzf ${rubbos_home}/workload.tar.gz",
+       path     => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+       require  => File['${rubbos_home}/workload.tar.gz'],
+  }
+
+  file {'${rubbos_home}/database.tar.gz':
+       ensure   => file,
+       path     => "${rubbos_home}/database.tar.gz",
+       source   => "puppet:///modules/rubbos_client/database.tar.gz",
+       backup   => false,
+  }
+
+  exec {'tar xvzf ${rubbos_home}/database.tar.gz':
+       cwd      => "${rubbos_home}",
+       command  => "tar xvzf ${rubbos_home}/database.tar.gz",
+       path     => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+       require  => File['${rubbos_home}/database.tar.gz'],
+  }
+
+  # build.properties
+  file {'${rubbos_home}/build.properties':
+        ensure          => file,
+        path            => "${rubbos_home}/build.properties",
+        source          => "puppet:///modules/rubbos_client/build.properties",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  # config.mk
+  file {'${rubbos_home}/config.mk':
+        ensure          => file,
+        path            => "${rubbos_home}/config.mk",
+        source          => "puppet:///modules/rubbos_client/config.mk",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  # Makefile
+  file {'${rubbos_home}/Makefile':
+        ensure          => file,
+        path            => "${rubbos_home}/Makefile",
+        source          => "puppet:///modules/rubbos_client/Makefile",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  # rubbos.properties.template
+  file {'${rubbos_home}/bench/rubbos.properties.template':
+        ensure          => file,
+        path            => "${rubbos_home}/bench/rubbos.properties.template",
+        source          => "puppet:///modules/rubbos_client/rubbos.properties.template",
+        show_diff       => false,
+        backup          => false,
+  }
+
+  # executable scripts
+  file {'${rubbos_home}/bench/run_emulator.sh':
+        ensure          => file,
+        path            => "${rubbos_home}/bench/run_emulator.sh",
+        source          => "puppet:///modules/rubbos_client/run_emulator.sh",
+        backup          => false,
+  }
+
+  # Build rubbos_client.jar
+  exec {'ant clean':
+        cwd             => "${rubbos_home}/Client",
+        command         => "${rubbos_app_tools}/apache-ant-1.6.5/bin/ant clean",
+        environment     => ["JAVA_HOME=${rubbos_app_tools}/jdk1.6.0_27","ANT_HOME=${rubbos_app_tools}/apache-ant-1.6.5"],
+        path            => [
+                        "/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin",
+                        "${rubbos_app_tools}/jdk1.6.0_27/bin",
+                        "${rubbos_app_tools}/jdk1.6.0_27/jre/bin",
+                        "${rubbos_app_tools}/apache-ant-1.6.5/bin"],
+        require         => [
+                        Exec['tar xzvf ${rubbos_app_tools}/j2sdkee1.3.1.jar.gz'],
+                        Exec['tar xzvf ${rubbos_app_tools}/apache-ant-1.6.5.tar.gz'],
+                        File['${rubbos_home}/build.properties'],
+                        File['${rubbos_home}/Makefile'],
+                        File['${rubbos_home}/config.mk'],
+                        Exec['tar xvzf ${rubbos_home}/Client.tar.gz']],
+                        #File['${rubbos_home}/Client']],
+  }
+
+  exec {'ant jar':
+        cwd             => "${rubbos_home}/Client",
+        command         => "${rubbos_app_tools}/apache-ant-1.6.5/bin/ant jar",
+        environment     => ["JAVA_HOME=${rubbos_app_tools}/jdk1.6.0_27","ANT_HOME=${rubbos_app_tools}/apache-ant-1.6.5"],
+        path            => [
+                        "/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin",
+                        "${rubbos_app_tools}/jdk1.6.0_27/bin",
+                        "${rubbos_app_tools}/jdk1.6.0_27/jre/bin",
+                        "${rubbos_app_tools}/apache-ant-1.6.5/bin"],
+        subscribe       => Exec['ant clean'],
+  }
+
+  # Change owner and group for the Client folder
+  exec {'chown -R ${rubbos_os_username}:${rubbos_os_usergroup} ${rubbos_home}/Client':
+        cwd             => "${rubbos_home}",
+        command         => "chown -R ${rubbos_os_username}:${rubbos_os_usergroup} ${rubbos_home}/Client",
+        path            => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        require         => Exec['ant jar'],
+  }
+
+}
index ed8dabb..b707231 100644 (file)
@@ -14,23 +14,40 @@ class rubbos_monitor::rubbos_monitor_off {
 
   # Declare some variables
   $rubbos_app           = $params::rubbos_params::rubbos_app
+  $rubbos_home          = $params::rubbos_params::rubbos_home
 
   # Make uninstall sysstat
   exec {'make uninstall sysstat':
         cwd     => "${rubbos_app}/sysstat-9.0.6",
         command => "make uninstall",
-       path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
-       onlyif  => "test -d ${rubbos_app}/sysstat-9.0.6",
+        path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        onlyif  => "test -d ${rubbos_app}/sysstat-9.0.6",
   }
 
-  # Remove folder
+  # Remove sysstat-9.0.6 folder
   file {'${rubbos_app}/sysstat-9.0.6':
         ensure  => absent,
         path    => "${rubbos_app}/sysstat-9.0.6",
         force   => true,
-       recurse => true,
+        recurse => true,
         backup  => false,
-        require        => Exec['make uninstall sysstat'],
+        require => Exec['make uninstall sysstat'],
+  }
+
+  # Remove bench folder
+  file {'${rubbos_home}/bench.tar.gz':
+        ensure  => absent,
+        path    => "${rubbos_home}/bench.tar.gz",
+        backup  => false,
+  }
+
+  file {'${rubbos_home}/bench':
+        ensure          => absent,
+        path            => "${rubbos_home}/bench",
+        force           => true,
+        recurse         => true,
+        backup          => false,
+        show_diff       => false,
   }
 
 }
index d396f30..b9dad5e 100644 (file)
@@ -16,20 +16,50 @@ class rubbos_monitor::rubbos_monitor_on {
   # Declare some variables
   $rubbos_app           = $params::rubbos_params::rubbos_app
   $rubbos_home          = $params::rubbos_params::rubbos_home
+  $rubbos_os_username   = $params::rubbos_params::rubbos_os_username
+  $rubbos_os_usergroup  = $params::rubbos_params::rubbos_os_usergroup
 
-  # Prepare bench folder and related files
+  # Prepare the bench folder and related files
   file {'${rubbos_home}/bench.tar.gz':
-       ensure  => file,
-       path    => "${rubbos_home}/bench.tar.gz",
-       source  => "puppet:///modules/rubbos_monitor/bench.tar.gz",
-       backup  => false,
+        ensure  => file,
+        path    => "${rubbos_home}/bench.tar.gz",
+        source  => "puppet:///modules/rubbos_monitor/bench.tar.gz",
+        backup  => false,
   }
 
   exec {'tar zxvf ${rubbos_home}/bench.tar.gz':
-       cwd             => "${rubbos_home}",
-        command        => "tar zxvf ${rubbos_home}/bench.tar.gz",
-       path            => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
-       subscribe       => File['${rubbos_home}/bench.tar.gz'],
+        cwd             => "${rubbos_home}",
+        command         => "tar zxvf ${rubbos_home}/bench.tar.gz",
+        path            => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        subscribe       => File['${rubbos_home}/bench.tar.gz'],
+  }
+
+  file {'flush_cache':
+        ensure  => file,
+        path    => "${rubbos_home}/bench/flush_cache",
+        source  => "puppet:///modules/rubbos_monitor/flush_cache",
+        backup  => false,
+        mode    => 0755,
+        require => Exec['tar zxvf ${rubbos_home}/bench.tar.gz'],
+  }
+
+  # Change owner and group for the bench folder
+  exec {'chown -R ${rubbos_os_username}:${rubbos_os_usergroup} ${rubbos_home}/bench':
+       cwd      => "${rubbos_home}",
+       command  => "chown -R ${rubbos_os_username}:${rubbos_os_usergroup} ${rubbos_home}/bench",
+       path     => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+       require  => File['flush_cache'],
+  }
+
+  # Prepare cpu_mem.sh
+  file {'cpu_mem.sh':
+        ensure  => file,
+        path    => "${rubbos_app}/cpu_mem.sh",
+        source  => "puppet:///modules/rubbos_monitor/cpu_mem.sh",
+        backup  => false,
+        mode    => 0755,
+        owner   => "${rubbos_os_username}",
+        group   => "${rubbos_os_usergroup}",
   }
 
   # Prepare monitoring tool
@@ -37,55 +67,44 @@ class rubbos_monitor::rubbos_monitor_on {
         ensure  => file,
         path    => "${rubbos_app}/sysstat-9.0.6.tar.gz",
         source  => "puppet:///modules/rubbos_monitor/sysstat-9.0.6.tar.gz",
-       backup  => false,
+        backup  => false,
   }
 
   exec {'tar xzvf ${rubbos_app}/sysstat-9.0.6.tar.gz':
         cwd     => "${rubbos_app}",
         command => "tar xzvf ${rubbos_app}/sysstat-9.0.6.tar.gz",
-       path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
         require => File['${rubbos_app}/sysstat-9.0.6.tar.gz'],
   }
 
-  file {'flush_cache':
-       ensure  => file,
-       path    => "${rubbos_home}/bench/flush_cache",
-       source  => "puppet:///modules/rubbos_monitor/flush_cache",
-       backup  => false,
-       mode    => 0755,
-       require => Exec['tar zxvf ${rubbos_home}/bench.tar.gz'],
-  }
-
-  file {'cpu_mem.sh':
-       ensure  => file,
-       path    => "${rubbos_app}/cpu_mem.sh",
-       source  => "puppet:///modules/rubbos_monitor/cpu_mem.sh",
-       backup  => false,
-       mode    => 0755,
-  }
-
   # Build and install sysstat
   exec {'configure sysstat':
-       cwd     => "${rubbos_app}/sysstat-9.0.6",
+        cwd     => "${rubbos_app}/sysstat-9.0.6",
         command => "${rubbos_app}/sysstat-9.0.6/configure --prefix=${rubbos_app}/sysstat-9.0.6 --disable-nls",
-       path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
-       require => [
-               Exec['tar xzvf ${rubbos_app}/sysstat-9.0.6.tar.gz'],
-               Package['make'],Package['gcc'],Package['g++']],
+        path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        require => Exec['tar xzvf ${rubbos_app}/sysstat-9.0.6.tar.gz'],
   }
 
   exec {'make sysstat':
-       cwd     => "${rubbos_app}/sysstat-9.0.6",
-       command => "make",
-       path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
-       require => Exec['configure sysstat'],
+        cwd     => "${rubbos_app}/sysstat-9.0.6",
+        command => "make",
+        path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        require => Exec['configure sysstat'],
   }
 
   exec {'make install sysstat':
-       cwd     => "${rubbos_app}/sysstat-9.0.6",
+        cwd     => "${rubbos_app}/sysstat-9.0.6",
         command => "make install",
-       path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
         require => Exec['make sysstat'],
   }
 
+  # Change owner and group for the sysstat
+  exec {'chown -R ${rubbos_os_username}:${rubbos_os_usergroup} ${rubbos_app}/sysstat-9.0.6':
+        cwd     => "${rubbos_app}",
+        command => "chown -R ${rubbos_os_username}:${rubbos_os_usergroup} ${rubbos_app}/sysstat-9.0.6",
+        path    => ["/bin","/sbin","/usr/bin","/usr/sbin","/usr/local/bin","/usr/local/sbin"],
+        require => Exec['make install sysstat'],
+  }
+
 }