summaryrefslogtreecommitdiffstats
path: root/extraconfig/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'extraconfig/tasks')
-rwxr-xr-xextraconfig/tasks/yum_update.sh41
-rw-r--r--extraconfig/tasks/yum_update.yaml26
2 files changed, 67 insertions, 0 deletions
diff --git a/extraconfig/tasks/yum_update.sh b/extraconfig/tasks/yum_update.sh
new file mode 100755
index 00000000..3d4c772b
--- /dev/null
+++ b/extraconfig/tasks/yum_update.sh
@@ -0,0 +1,41 @@
+#!/bin/bash
+
+# A heat-config-script which runs yum update during a stack-update.
+# Inputs:
+# deploy_action - yum will only be run if this is UPDATE
+# update_identifier - yum will only run for previously unused values of update_identifier
+# command - yum sub-command to run, defaults to "update"
+# command_arguments - yum command arguments, defaults to ""
+
+echo "Started yum_update.sh on server $deploy_server_id at `date`"
+
+if [[ -z "$update_identifier" ]]; then
+ echo "Not running due to unset update_identifier"
+ exit 0
+fi
+
+timestamp_dir=/var/lib/overcloud-yum-update
+mkdir -p $timestamp_dir
+
+# sanitise to remove unusual characters
+update_identifier=${update_identifier//[^a-zA-Z0-9-_]/}
+
+timestamp_file="$timestamp_dir/$update_identifier"
+if [[ -a "$timestamp_file" ]]; then
+ echo "Not running for already-run timestamp \"$update_identifier\""
+ exit 0
+fi
+touch "$timestamp_file"
+
+command=${command:-update}
+full_command="yum -y $command $command_arguments"
+echo "Running: $full_command"
+
+result=$($full_command)
+return_code=$?
+echo "$result"
+echo "yum return code: $return_code"
+
+echo "Finished yum_update.sh on server $deploy_server_id at `date`"
+
+exit $return_code
diff --git a/extraconfig/tasks/yum_update.yaml b/extraconfig/tasks/yum_update.yaml
new file mode 100644
index 00000000..e918149e
--- /dev/null
+++ b/extraconfig/tasks/yum_update.yaml
@@ -0,0 +1,26 @@
+heat_template_version: 2014-10-16
+
+description: >
+ Software-config for performing package updates using yum
+
+resources:
+
+ config:
+ type: OS::Heat::SoftwareConfig
+ properties:
+ group: script
+ config: {get_file: yum_update.sh}
+ inputs:
+ - name: update_identifier
+ description: yum will only run for previously unused values of update_identifier
+ default: ''
+ - name: command
+ description: yum sub-command to run, defaults to "update"
+ default: update
+ - name: command_arguments
+ description: yum command arguments, defaults to ""
+ default: ''
+
+outputs:
+ OS::stack_id:
+ value: {get_resource: config} \ No newline at end of file