utils.py: Make config_get/unit_get more robust.

This commit is contained in:
Adam Gandelman 2013-03-01 14:00:08 -08:00
parent 07dbf55409
commit 8cc87dcbb6
2 changed files with 11 additions and 3 deletions

View File

@ -263,7 +263,11 @@ def unit_get(attribute):
'unit-get',
attribute
]
return subprocess.check_output(cmd).strip() # IGNORE:E1103
value = subprocess.check_output(cmd).strip() # IGNORE:E1103
if value == "":
return None
else:
return value
def config_get(attribute):
@ -271,7 +275,11 @@ def config_get(attribute):
'config-get',
attribute
]
return subprocess.check_output(cmd).strip() # IGNORE:E1103
value = subprocess.check_output(cmd).strip() # IGNORE:E1103
if value == "":
return None
else:
return value
def get_unit_hostname():

View File

@ -1 +1 @@
68
69