Skip to content

Commit 0469f70

Browse files
markgoddardblackboxsw
authored andcommitted
Fix metadata check when local-hostname is null (canonical#32)
Fix traceback when running with a config drive containing a metadata file which has local-hostname set to null. Cloud-init ignores absent local-hostname or None values. LP: #1852100
1 parent 6214a57 commit 0469f70

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

cloudinit/sources/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,7 @@ def get_hostname(self, fqdn=False, resolve_ip=False, metadata_only=False):
568568
defhost = "localhost"
569569
domain = defdomain
570570

571-
if not self.metadata or 'local-hostname' not in self.metadata:
571+
if not self.metadata or not self.metadata.get('local-hostname'):
572572
if metadata_only:
573573
return None
574574
# this is somewhat questionable really.

0 commit comments

Comments
 (0)