Ensure Puppet can run even on PoC net setups
For `puppet apply` to run successfully, outputs of `hostname -f` and `facter fqdn` must match. In a properly configured network environment the outputs should always match, in PoC environment they might not. This patch overrides the FQDN fact to the result of `hostname -f`, which will make `puppet apply` succeed even in PoC environments where DNS is not configured properly. Change-Id: I0d63fb0b862f984a196ac01345c74b4e5378e8a8 Partial-Bug: #1447497
This commit is contained in:
parent
d26e55b800
commit
45dd5c8fc8
@ -32,6 +32,16 @@ def prepare_dir(path):
|
||||
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):
|
||||
log = logging.getLogger('heat-config')
|
||||
handler = logging.StreamHandler(sys.stderr)
|
||||
@ -53,6 +63,10 @@ def main(argv=sys.argv):
|
||||
facts = {}
|
||||
hiera = {}
|
||||
|
||||
fqdn = get_hostname_f(log)
|
||||
if fqdn:
|
||||
facts['FACTER_fqdn'] = fqdn
|
||||
|
||||
for input in c['inputs']:
|
||||
input_name = input['name']
|
||||
input_value = input.get('value', '')
|
||||
|
Loading…
Reference in New Issue
Block a user