From ff0832fdf376154ea6ec50d6b40a2c7635402333 Mon Sep 17 00:00:00 2001 From: Greg Neagle Date: Wed, 30 May 2018 08:10:01 -0700 Subject: [PATCH] Don't crash if DomainName is not set in the current network configuration when attempting to auto-detect the repo URL --- code/client/munkilib/updatecheck/autoconfig.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/client/munkilib/updatecheck/autoconfig.py b/code/client/munkilib/updatecheck/autoconfig.py index f73a7640..d8d79051 100644 --- a/code/client/munkilib/updatecheck/autoconfig.py +++ b/code/client/munkilib/updatecheck/autoconfig.py @@ -36,7 +36,7 @@ from .. import prefs def get_domain_name(): '''Return current domain name''' dns_config = SCDynamicStoreCopyValue(None, 'State:/Network/Global/DNS') - return dns_config['DomainName'] + return dns_config.get('DomainName') def guess_repo_url(): @@ -47,9 +47,12 @@ def guess_repo_url(): autodetected_url = 'http://munki/repo' domain_name = get_domain_name() + if domain_name is None: + # No DomainName set + return autodetected_url + if domain_name == 'local': # no guesses if we are on a .local domain - print 'Warning: .local' return autodetected_url possible_urls = [