Skip to content

Commit 8007581

Browse files
committed
Handle missing asset tags in JAMF
Change the try/except from a raise to an if that uses the code block to extract serial number when JAMF's asset tag is missing.
1 parent e539f4c commit 8007581

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

jamf2snipe

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,11 @@ for jamf_type in jamf_types:
790790
try:
791791
jamf_asset_tag = jamf['{}'.format(tag_split[0])]['{}'.format(tag_split[1])]
792792
except:
793-
raise SystemError('No such attribute {} in the jamf payload. Please check your settings.conf file'.format(tag_split))
793+
if jamf_type == 'mobile_devices':
794+
jamf_asset_tag = 'jamfid-m-{}'.format(jamf['general']['id'])
795+
elif jamf_type == 'computers':
796+
jamf_asset_tag = 'jamfid-{}'.format(jamf['general']['id'])
797+
#raise SystemError('No such attribute {} in the jamf payload. Please check your settings.conf file'.format(tag_split))
794798
if jamf_asset_tag == None or jamf_asset_tag == '':
795799
logging.debug('No custom configuration found in settings.conf for asset tag name upon asset creation.')
796800
if jamf_type == 'mobile_devices':

0 commit comments

Comments
 (0)