From: calvinosanc1 Date: Mon, 17 Aug 2020 09:45:15 +0000 (+0200) Subject: Update juju images X-Git-Tag: release-v9.0-start~77 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=0c82da075268f5891dce618c8bc6e116dfde8493;p=osm%2Fdevops.git Update juju images Change-Id: I661fa4bb2030fe6a0b4a75ac435a046bc46e2a90 Signed-off-by: calvinosanc1 --- diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 72d90c20..06880687 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -183,6 +183,10 @@ function remove_helm() { fi } +function remove_crontab_job() { + crontab -l | grep -v '${OSM_DEVOPS}/installers/update-juju-lxc-images' | crontab - +} + #Uninstall osmclient function uninstall_osmclient() { sudo apt-get remove --purge -y python-osmclient @@ -245,6 +249,7 @@ EONG $WORKDIR_SUDO rm -rf $OSM_DOCKER_WORK_DIR [ -z "$CONTROLLER_NAME" ] && sg lxd -c "juju destroy-controller --destroy-all-models --yes $OSM_STACK_NAME" fi + remove_crontab_job uninstall_osmclient echo "Some docker images will be kept in case they are used by other docker stacks" echo "To remove them, just run 'docker image prune' in a terminal" @@ -276,6 +281,11 @@ function FATAL(){ exit 1 } +function update_juju_images(){ + crontab -l | grep update-juju-lxc-images || (crontab -l 2>/dev/null; echo "0 4 * * 6 $USER ${OSM_DEVOPS}/installers/update-juju-lxc-images --xenial --bionic") | crontab - + ${OSM_DEVOPS}/installers/update-juju-lxc-images --xenial --bionic +} + function install_lxd() { # Apply sysctl production values for optimal performance sudo cp ${OSM_DEVOPS}/installers/60-lxd-production.conf /etc/sysctl.d/60-lxd-production.conf @@ -414,6 +424,7 @@ function install_juju() { echo "Installing juju" sudo snap install juju --classic --channel=2.7/stable [[ ":$PATH": != *":/snap/bin:"* ]] && PATH="/snap/bin:${PATH}" + update_juju_images echo "Finished installation of juju" return 0 } diff --git a/installers/update-juju-lxc-images b/installers/update-juju-lxc-images index 88be1271..18f85c98 100755 --- a/installers/update-juju-lxc-images +++ b/installers/update-juju-lxc-images @@ -98,6 +98,7 @@ function cache() { alias=juju/$series/amd64 lxc delete $container -f || true + lxc image copy ubuntu:$series local: --alias clean-$series lxc launch ubuntu:$series $container sleep 15 # wait for network @@ -121,6 +122,7 @@ function cache() { lxc stop $container lxc image delete $alias || true + lxc image delete clean-$series || true lxc publish $container --alias $alias description="$series juju dev image ($(date +%Y%m%d))" lxc delete $container -f || true