From c4a12db99ca3789cf9e0e3475bba8f12e9b29e0b Mon Sep 17 00:00:00 2001 From: Alexis de Talhouët Date: Wed, 8 Mar 2017 10:03:14 -0500 Subject: Do not start chef-solo if mso-docker.json is empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Chef-solo is started both from the docker container [1] and from the start-jboss-server.sh script [2]. The Dockerfile is configured to erase the mso-docker.json configuration once applied, so when the container is started, and the strat-jboss-server.sh tries to play the recipes again, it fails as the environment file is empty. This patch adds a check to see if the file is empty, if not, we play the chef-solo recipes again, to overwrite the config. [1]: https://gerrit.openecomp.org/r/gitweb?p=mso.git;a=blob;f=packages/docker/src/main/docker/docker-files/Dockerfile.mso-chef-final;h=ff7f44bcfdba6fa0328cbd50803d3dc80a2a1def;hb=refs/heads/master#l57 [2]: https://gerrit.openecomp.org/r/gitweb?p=mso.git;a=blob;f=packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh;h=2e9b9da27dd3d01fcf5ebc304ac03b15142fde53;hb=refs/heads/master#l16 Change-Id: I34573dedaaafbeb6b511f47b72e6e0cefea4e1d5 Signed-off-by: Alexis de Talhouët --- .../main/docker/docker-files/scripts/start-jboss-server.sh | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) mode change 100644 => 100755 packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh (limited to 'packages/docker') diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh b/packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh old mode 100644 new mode 100755 index 2e9b9da27d..d8d81cca6c --- a/packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh +++ b/packages/docker/src/main/docker/docker-files/scripts/start-jboss-server.sh @@ -12,9 +12,14 @@ update-ca-certificates echo 'Running in JBOSS' su - jboss -#Start the chef-solo -chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra] - +#Start the chef-solo if mso-docker.json contains some data. +if [ -s /var/berks-cookbooks/${CHEF_REPO_NAME}/environments/mso-docker.json ] +then + echo "mso-docker.json has some configuration, replay the recipes." + chef-solo -c /var/berks-cookbooks/${CHEF_REPO_NAME}/solo.rb -o recipe[mso-config::apih],recipe[mso-config::bpmn],recipe[mso-config::jra] +else + echo "mso-docker.json is empty, do not replay the recipes." +fi JBOSS_PIDFILE=/tmp/jboss-standalone.pid $JBOSS_HOME/bin/standalone.sh -c standalone-full-ha-mso.xml & -- cgit 1.2.3-korg