#!/bin/bash

set -xe

# Copy the old MCollective configuration to the location of the
# MCollective configuration file in the ruby193 SCL.
command mv -f /etc/openshift/upgrade/2/client.cfg /opt/rh/ruby193/root/etc/mcollective/client.cfg

conf=/etc/openshift/plugins.d/openshift-origin-msg-broker-mcollective.conf
command cp -f $conf{,.ugsave.`date +%Y-%m-%d-%H:%M:%S`}

sed -i "$conf" \
  -e '/^\s*MCOLLECTIVE_CONFIG=/ cMCOLLECTIVE_CONFIG="/opt/rh/ruby193/root/etc/mcollective/client.cfg"'
