diff --git a/build.gradle b/build.gradle
index c2fc4f9..baf59be 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,7 +27,7 @@ repositories {
group = "com.electriccloud"
description = "Plugins : EC-Chef"
-version = "1.2.1"
+version = "1.2.2"
apply plugin: 'flow-gradle-plugin'
diff --git a/src/main/resources/project/drivers/RunChefClientDriver.pl b/src/main/resources/project/drivers/RunChefClientDriver.pl
index af2f983..7a45b67 100644
--- a/src/main/resources/project/drivers/RunChefClientDriver.pl
+++ b/src/main/resources/project/drivers/RunChefClientDriver.pl
@@ -37,10 +37,10 @@
# -------------------------------------------------------------------------
# Main functions
# -------------------------------------------------------------------------
-
+
###########################################################################
=head2 main
-
+
Title : main
Usage : main();
Function : Performs a Chef run
@@ -53,7 +53,7 @@ =head2 main
sub main {
my $ec = ElectricCommander->new();
$ec->abortOnError(0);
-
+
# -------------------------------------------------------------------------
# Parameters
# -------------------------------------------------------------------------
@@ -67,7 +67,8 @@ sub main {
$::g_interval = ($ec->getProperty( "interval" ))->findvalue('//value')->string_value;
$::g_log_level = ($ec->getProperty( "log_level" ))->findvalue('//value')->string_value;
$::g_additional_commands = ($ec->getProperty( "additional_commands" ))->findvalue('//value')->string_value;
-
+ $::g_elevation_utility = ($ec->getProperty( "elevation_utility" ))->findvalue('//value')->string_value;
+
#Variable that stores the command to be executed
$::g_command = $::g_chef_client_path;
@@ -80,63 +81,67 @@ sub main {
my $pluginName = $xpath->findvalue('//pluginVersion')->value;
print "Using plugin $pluginKey version $pluginName\n";
print "Running procedure RunChefClient\n";
-
+
#Parameters are checked to see which should be included
if($::g_node_name && $::g_node_name ne '')
{
$::g_command = $::g_command . " --node-name " . $::g_node_name;
}
-
+
if($::g_replace_current_run_list && $::g_replace_current_run_list ne '')
{
$::g_command = $::g_command . " --override-runlist " . $::g_replace_current_run_list;
}
-
+
if($::g_json_attributes_definition && $::g_json_attributes_definition ne '')
{
$::g_command = $::g_command . " --json-attributes " . $::g_json_attributes_definition;
}
-
+
if($::g_chef_server_url && $::g_chef_server_url ne '')
{
$::g_command = $::g_command . " --server " . $::g_chef_server_url;
}
-
+
if($::g_configuration_file && $::g_configuration_file ne '')
{
$::g_command = $::g_command . " --config " . $::g_configuration_file;
}
-
+
if($::g_interval && $::g_interval ne '')
{
$::g_command = $::g_command . " --interval " . $::g_interval;
}
-
+
if($::g_log_level && $::g_log_level ne '')
{
$::g_command = $::g_command . " --log_level " . $::g_log_level;
}
-
+
if($::g_log_file_location && $::g_log_file_location ne '')
{
$::g_command = $::g_command . " --logfile " . $::g_log_file_location;
}
-
+
if($::g_daemonize && $::g_daemonize ne '')
{
$::g_command = $::g_command . " --daemonize";
}
-
+
if($::g_additional_commands && $::g_additional_commands ne '')
{
$::g_command = $::g_command . " " . $::g_additional_commands;
}
+ if ($::g_elevation_utility) {
+ $::g_command = $::g_elevation_utility . ' ' . $::g_command;
+ }
+
#Print out the command to be executed
print "\nCommand to be executed: \n$::g_command \n\n";
-
+
#Executes the command
system("$::g_command");
}
-
+
main();
diff --git a/src/main/resources/project/forms/RunChefClient.xml b/src/main/resources/project/forms/RunChefClient.xml
index 10202aa..169dc0d 100644
--- a/src/main/resources/project/forms/RunChefClient.xml
+++ b/src/main/resources/project/forms/RunChefClient.xml
@@ -102,4 +102,12 @@
0
Provide any additional commands if needed.
+
+ entry
+
+
+ elevation_utility
+ 0
+ Provide the name of privilege elevation utility, for example, sudo.
+
diff --git a/src/main/resources/project/project.xml b/src/main/resources/project/project.xml
index b657b81..26b411f 100644
--- a/src/main/resources/project/project.xml
+++ b/src/main/resources/project/project.xml
@@ -666,7 +666,7 @@
- DeleteConfiguration
+ DeleteConfiguration
Delete an EC-Chef configuration.
EC-Chef-DeleteConfiguration-$[jobId]
@@ -2105,7 +2105,7 @@
0
-
+
@@ -2534,7 +2534,7 @@
- RunChefClient
+ RunChefClient
Performs a Chef run.
@@ -2607,6 +2607,16 @@
+
+ elevation_utility
+
+
+ formType
+ 1
+ standard
+
+
+
daemonize
@@ -2826,6 +2836,13 @@
0
select
+
+ elevation_utility
+
+ Provide the name of privilege elevation utility, for example, sudo.
+ 0
+ entry
+
additional_commands
@@ -2903,6 +2920,16 @@
+
+ elevation_utility
+
+
+ formType
+ 1
+ standard
+
+
+
chef_server_url
@@ -3142,7 +3169,7 @@
entry
- daemonize
+ daemonize
If checked the process will be daemonized.
0
@@ -3169,6 +3196,13 @@
0
textarea
+
+ elevation_utility
+
+
+ 0
+ entry
+
runChef
0
@@ -3220,7 +3254,7 @@
parameters
- config
+ config
formType
@@ -5492,7 +5526,7 @@
standard
-
+
result_property