summaryrefslogtreecommitdiff
path: root/cloudinit/cmd/cloud_id.py
diff options
context:
space:
mode:
Diffstat (limited to 'cloudinit/cmd/cloud_id.py')
-rwxr-xr-xcloudinit/cmd/cloud_id.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/cloudinit/cmd/cloud_id.py b/cloudinit/cmd/cloud_id.py
index b92b03a8..b71c19de 100755
--- a/cloudinit/cmd/cloud_id.py
+++ b/cloudinit/cmd/cloud_id.py
@@ -6,6 +6,7 @@ import argparse
import json
import sys
+from cloudinit.cmd.status import UXAppStatus, get_status_details
from cloudinit.sources import (
INSTANCE_JSON_FILE,
METADATA_UNKNOWN,
@@ -62,8 +63,16 @@ def handle_args(name, args):
Print the canonical cloud-id on which the instance is running.
- @return: 0 on success, 1 otherwise.
+ @return: 0 on success, 1 on error, 2 on disabled, 3 on cloud-init not-run.
"""
+ status, _status_details, _time = get_status_details()
+ if status == UXAppStatus.DISABLED:
+ sys.stdout.write("{0}\n".format(status.value))
+ return 2
+ elif status == UXAppStatus.NOT_RUN:
+ sys.stdout.write("{0}\n".format(status.value))
+ return 3
+
try:
instance_data = json.load(open(args.instance_data))
except IOError: