Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down
37 changes: 21 additions & 16 deletions src/main/resources/project/drivers/RunChefClientDriver.pl
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
# -------------------------------------------------------------------------
# Main functions
# -------------------------------------------------------------------------

###########################################################################
=head2 main

Title : main
Usage : main();
Function : Performs a Chef run
Expand All @@ -53,7 +53,7 @@ =head2 main
sub main {
my $ec = ElectricCommander->new();
$ec->abortOnError(0);

# -------------------------------------------------------------------------
# Parameters
# -------------------------------------------------------------------------
Expand All @@ -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;

Expand All @@ -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();
8 changes: 8 additions & 0 deletions src/main/resources/project/forms/RunChefClient.xml
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,12 @@
<required>0</required>
<documentation>Provide any additional commands if needed.</documentation>
</formElement>
<formElement>
<type>entry</type>
<label>Privilege Elevation Utility:</label>
<value></value>
<property>elevation_utility</property>
<required>0</required>
<documentation>Provide the name of privilege elevation utility, for example, sudo.</documentation>
</formElement>
</editor>
46 changes: 40 additions & 6 deletions src/main/resources/project/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@
</step>
</procedure>
<procedure>
<procedureName>DeleteConfiguration</procedureName>
<procedureName>DeleteConfiguration</procedureName>
<description>Delete an EC-Chef configuration.</description>
<jobNameTemplate>EC-Chef-DeleteConfiguration-$[jobId]</jobNameTemplate>
<resourceName></resourceName>
Expand Down Expand Up @@ -2105,7 +2105,7 @@
<value>0</value>
</property>
</propertySheet>
</property>
</property>
</propertySheet>
</property>
</propertySheet>
Expand Down Expand Up @@ -2534,7 +2534,7 @@
</step>
</procedure>
<procedure>
<procedureName>RunChefClient</procedureName>
<procedureName>RunChefClient</procedureName>
<description>Performs a Chef run.</description>
<jobNameTemplate/>
<resourceName/>
Expand Down Expand Up @@ -2607,6 +2607,16 @@
</property>
</propertySheet>
</property>
<property>
<propertyName>elevation_utility</propertyName>
<propertySheet>
<property>
<propertyName>formType</propertyName>
<expandable>1</expandable>
<value>standard</value>
</property>
</propertySheet>
</property>
<property>
<propertyName>daemonize</propertyName>
<propertySheet>
Expand Down Expand Up @@ -2826,6 +2836,13 @@
<required>0</required>
<type>select</type>
</formalParameter>
<formalParameter>
<formalParameterName>elevation_utility</formalParameterName>
<defaultValue></defaultValue>
<description>Provide the name of privilege elevation utility, for example, sudo.</description>
<required>0</required>
<type>entry</type>
</formalParameter>
<formalParameter>
<formalParameterName>additional_commands</formalParameterName>
<defaultValue/>
Expand Down Expand Up @@ -2903,6 +2920,16 @@
</property>
</propertySheet>
</property>
<property>
<propertyName>elevation_utility</propertyName>
<propertySheet>
<property>
<propertyName>formType</propertyName>
<expandable>1</expandable>
<value>standard</value>
</property>
</propertySheet>
</property>
<property>
<propertyName>chef_server_url</propertyName>
<propertySheet>
Expand Down Expand Up @@ -3142,7 +3169,7 @@
<type>entry</type>
</formalParameter>
<formalParameter>
<formalParameterName>daemonize</formalParameterName>
<formalParameterName>daemonize</formalParameterName>
<defaultValue></defaultValue>
<description>If checked the process will be daemonized.</description>
<required>0</required>
Expand All @@ -3169,6 +3196,13 @@
<required>0</required>
<type>textarea</type>
</formalParameter>
<formalParameter>
<formalParameterName>elevation_utility</formalParameterName>
<defaultValue/>
<description></description>
<required>0</required>
<type>entry</type>
</formalParameter>
<step>
<stepName>runChef</stepName>
<alwaysRun>0</alwaysRun>
Expand Down Expand Up @@ -3220,7 +3254,7 @@
<propertyName>parameters</propertyName>
<propertySheet>
<property>
<propertyName>config</propertyName>
<propertyName>config</propertyName>
<propertySheet>
<property>
<propertyName>formType</propertyName>
Expand Down Expand Up @@ -5492,7 +5526,7 @@
<value>standard</value>
</property>
</propertySheet>
</property>
</property>
<property>
<propertyName>result_property</propertyName>
<propertySheet>
Expand Down