diff options
author | Scott Moser <smoser@ubuntu.com> | 2018-04-26 16:24:24 -0500 |
---|---|---|
committer | Ryan Harper <ryan.harper@canonical.com> | 2018-04-26 16:24:24 -0500 |
commit | 6ef92c98c3d2b127b05d6708337efc8a81e00071 (patch) | |
tree | 9d7bc15bbc750effce7e90915ef47fc10aee649d /tools | |
parent | 4731c8da25ee9bfbcf0ade1d7ffec95814d8622a (diff) | |
download | vyos-cloud-init-6ef92c98c3d2b127b05d6708337efc8a81e00071.tar.gz vyos-cloud-init-6ef92c98c3d2b127b05d6708337efc8a81e00071.zip |
IBMCloud: recognize provisioning environment during debug boots.
When images are deployed from template in a production environment
the artifacts of the provisioning stage (provisioningConfiguration.cfg)
that cloud-init referenced are cleaned up. However, when provisioned
in "debug" mode (internal to IBM) the artifacts are left.
This changes the 'is_ibm_provisioning' implementations in both
ds-identify and in the IBM datasource to identify the provisioning
stage more correctly. The change is to consider provisioning only
if the provisioing file existed and there was no log file or
the log file was older than this boot.
LP: #1767166
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/ds-identify | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/tools/ds-identify b/tools/ds-identify index 9a2db5c4..7fff5d1e 100755 --- a/tools/ds-identify +++ b/tools/ds-identify @@ -125,6 +125,7 @@ DI_ON_NOTFOUND="" DI_EC2_STRICT_ID_DEFAULT="true" _IS_IBM_CLOUD="" +_IS_IBM_PROVISIONING="" error() { set -- "ERROR:" "$@"; @@ -1006,7 +1007,25 @@ dscheck_Hetzner() { } is_ibm_provisioning() { - [ -f "${PATH_ROOT}/root/provisioningConfiguration.cfg" ] + local pcfg="${PATH_ROOT}/root/provisioningConfiguration.cfg" + local logf="${PATH_ROOT}/root/swinstall.log" + local is_prov=false msg="config '$pcfg' did not exist." + if [ -f "$pcfg" ]; then + msg="config '$pcfg' exists." + is_prov=true + if [ -f "$logf" ]; then + if [ "$logf" -nt "$PATH_PROC_1_ENVIRON" ]; then + msg="$msg log '$logf' from current boot." + else + is_prov=false + msg="$msg log '$logf' from previous boot." + fi + else + msg="$msg log '$logf' did not exist." + fi + fi + debug 2 "ibm_provisioning=$is_prov: $msg" + [ "$is_prov" = "true" ] } is_ibm_cloud() { |