Merge "Ensure Puppet can run even on PoC net setups"

This commit is contained in:
Jenkins 2015-04-28 10:03:24 +00:00 committed by Gerrit Code Review
commit 13e8dd6917

View File

@ -32,6 +32,16 @@ def prepare_dir(path):
os.makedirs(path, 0o700) os.makedirs(path, 0o700)
def get_hostname_f(log):
subproc = subprocess.Popen(['hostname', '-f'], stdout=subprocess.PIPE)
out = subproc.communicate()[0]
if subproc.returncode == 0:
return out.strip()
else:
log.warn("Failed to retrieve 'hostname -f' output")
return None
def main(argv=sys.argv): def main(argv=sys.argv):
log = logging.getLogger('heat-config') log = logging.getLogger('heat-config')
handler = logging.StreamHandler(sys.stderr) handler = logging.StreamHandler(sys.stderr)
@ -53,6 +63,10 @@ def main(argv=sys.argv):
facts = {} facts = {}
hiera = {} hiera = {}
fqdn = get_hostname_f(log)
if fqdn:
facts['FACTER_fqdn'] = fqdn
for input in c['inputs']: for input in c['inputs']:
input_name = input['name'] input_name = input['name']
input_value = input.get('value', '') input_value = input.get('value', '')