From: Michael Marchetti Date: Wed, 11 Jul 2018 18:30:34 +0000 (+0200) Subject: Merge "Add build_dir variable for build" X-Git-Tag: BUILD_v4.0.1_1~7 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=8d9808e38b027601a07a62e931ceada44e32afbb;hp=6d3457b79dde5a49850f9f38a5ebb23500835858;p=osm%2Fdevops.git Merge "Add build_dir variable for build" --- diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 2286aa4b..cee7c8dd 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -720,11 +720,14 @@ function deploy_perfmon() { function install_lightweight() { [ "$USER" == "root" ] && FATAL "You are running the installer as root. The installer is prepared to be executed as a normal user with sudo privileges." [ -z "$ASSUME_YES" ] && ! ask_user "The installation will configure LXD, install juju, install docker CE and init a docker swarm, as pre-requirements. Do you want to proceed (Y/n)? " y && echo "Cancelled!" && exit 1 + track proceed echo "Installing lightweight build of OSM" LWTEMPDIR="$(mktemp -d -q --tmpdir "installosmlight.XXXXXX")" trap 'rm -rf "${LWTEMPDIR}"' EXIT DEFAULT_IF=`route -n |awk '$1~/^0.0.0.0/ {print $8}'` + [ -z "$DEFAULT_IF" ] && FATAL "Not possible to determine the interface with the default route 0.0.0.0" DEFAULT_IP=`ip -o -4 a |grep ${DEFAULT_IF}|awk '{split($4,a,"/"); print a[1]}'` + [ -z "$DEFAULT_IP" ] && FATAL "Not possible to determine the IP address of the interface with the default route" DEFAULT_MTU=$(ip addr show ${DEFAULT_IF} | perl -ne 'if (/mtu\s(\d+)/) {print $1;}') if [ -z "$INSTALL_NOLXD" ]; then need_packages_lw="lxd" @@ -738,6 +741,7 @@ function install_lightweight() { || sudo apt-get install -y $need_packages_lw \ || FATAL "failed to install $need_packages_lw" fi + track prereqok install_juju OSMLCM_VCA_HOST=`sg lxd -c "juju show-controller"|grep api-endpoints|awk -F\' '{print $2}'|awk -F\: '{print $1}'` OSMLCM_VCA_SECRET=`grep password ${HOME}/.local/share/juju/accounts.yaml |awk '{print $2}'` @@ -777,10 +781,10 @@ function install_vimemu() { echo "Starting vim-emu Docker container 'vim-emu' ..." if [ -n "$INSTALL_LIGHTWEIGHT" ]; then # in lightweight mode, the emulator needs to be attached to netOSM - sudo docker run --name vim-emu -t -d --rm --privileged --pid='host' --network=netOSM -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py + sudo docker run --name vim-emu -t -d --restart always --privileged --pid='host' --network=netOSM -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py else # classic build mode - sudo docker run --name vim-emu -t -d --rm --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py + sudo docker run --name vim-emu -t -d --restart always --privileged --pid='host' -v /var/run/docker.sock:/var/run/docker.sock vim-emu-img python examples/osm_default_daemon_topology_2_pop.py fi echo "Waiting for 'vim-emu' container to start ..." sleep 5 diff --git a/juju-charms/layers/simple/actions/touch b/juju-charms/layers/simple/actions/touch index d85d3fac..7e30af4c 100755 --- a/juju-charms/layers/simple/actions/touch +++ b/juju-charms/layers/simple/actions/touch @@ -18,15 +18,14 @@ import sys sys.path.append('lib') -from charms.reactive import main -from charms.reactive import set_state +from charms.reactive import main, set_flag from charmhelpers.core.hookenv import action_fail, action_name """ `set_state` only works here because it's flushed to disk inside the `main()` loop. remove_state will need to be called inside the action method. """ -set_state('actions.{}'.format(action_name())) +set_flag('actions.{}'.format(action_name())) try: main() diff --git a/juju-charms/layers/simple/reactive/simple.py b/juju-charms/layers/simple/reactive/simple.py index 2a55a5c7..8355bf30 100644 --- a/juju-charms/layers/simple/reactive/simple.py +++ b/juju-charms/layers/simple/reactive/simple.py @@ -5,8 +5,8 @@ from charmhelpers.core.hookenv import ( status_set, ) from charms.reactive import ( - remove_state as remove_flag, - set_state as set_flag, + clear_flag, + set_flag, when, when_not, ) @@ -41,4 +41,4 @@ def touch(): else: action_set({'outout': result}) finally: - remove_flag('actions.touch') + clear_flag('actions.touch')