Code Review
/
releng
/
global-jjb.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
CI: Switch to using reuse for license checking
[releng/global-jjb.git]
/
shell
/
capture-instance-metadata.sh
diff --git
a/shell/capture-instance-metadata.sh
b/shell/capture-instance-metadata.sh
index
a5914ad
..
a5e0051
100644
(file)
--- a/
shell/capture-instance-metadata.sh
+++ b/
shell/capture-instance-metadata.sh
@@
-11,17
+11,33
@@
echo "---> capture-instance-metadata.sh"
echo "---> capture-instance-metadata.sh"
+# shellcheck disable=SC1090
+source ~/lf-env.sh
+
+if [[ "${PYTHON:-}" -ne "" ]]; then
+ lf-activate-venv --python "$PYTHON" lftools
+elif python3; then
+ lf-activate-venv --python python3 lftools
+else
+ lf-activate-venv lftools
+fi
+
# detect if we're in EC2
if [ -n "${NOMAD_DC}" ]; then
echo "INFO: Running in Nomad, no metadata"
exit 0
fi
# detect if we're in EC2
if [ -n "${NOMAD_DC}" ]; then
echo "INFO: Running in Nomad, no metadata"
exit 0
fi
+if [[ ! -f /run/cloud-init/result.json ]]; then
+ echo "INFO: Running in unsupported cloud, no metadata"
+ exit 0
+fi
+
# AWS not supported, exit
cloudtype="$(jq -r .v1.datasource /run/cloud-init/result.json)"
if [[ $cloudtype == "DataSourceEc2Local" ]]; then
# AWS not supported, exit
cloudtype="$(jq -r .v1.datasource /run/cloud-init/result.json)"
if [[ $cloudtype == "DataSourceEc2Local" ]]; then
- echo "INFO: Running in AWS, not capturing instance metadata"
- exit 0
+
echo "INFO: Running in AWS, not capturing instance metadata"
+
exit 0
fi
# Retrive OpenStack instace metadata APIs at this IP.
fi
# Retrive OpenStack instace metadata APIs at this IP.