macadmins / nudge-python

A tool to help users with pre-existing devices upgrade their OS version.
Apache License 2.0
213 stars 48 forks source link

If minimum_os_sub_build_version not specified, check fails #24

Closed delize closed 4 years ago

delize commented 4 years ago

I found during testing that if you don’t specify "minimum_os_sub_build_version": it defaults to the value here: https://github.com/erikng/nudge/blob/3901ca478b32a323924f7b443826c4ead61c3a60/payload/Library/Application%20Support/nudge/Resources/nudge#L387

Which is 18G84, which when attempting to run a 10.15.1 OS Update, causes the tool to simply not run. This is because it appears that minimum_os_sub_build_version takes a higher priority over the major version from the looks of it.

Without "minimum_os_sub_build_version": specified in the config.json:

    /Library/Application\ Support/nudge/Resources/nudge --jsonurl=ourURLhere
    Starting download: ourURLhere
    2019-11-25 22:14:29.884 Python[4958:5194034] URLSession_task_didReceiveChallenge_completionHandler_
    2019-11-25 22:14:29.884 Python[4958:5194034] Authentication challenge for Host: storage.googleapis.com Realm: None AuthMethod: NSURLAuthenticationMethodServerTrust
    2019-11-25 22:14:29.884 Python[4958:5194034] Allowing OS to handle authentication request
    Downloading nudge.json - Percent complete: 0
    Status: 200
    Headers: {u'x-goog-metageneration': u'1', u'Last-Modified': u'Tue, 26 Nov 2019 06:14:06 GMT', u'x-goog-stored-content-length': u'1532', u'Accept-Ranges': u'bytes', u'Expires': u'Tue, 26 Nov 2019 06:14:31 GMT', u'Content-Length': u'1532', u'Server': u'UploadServer', u'x-goog-stored-content-encoding': u'identity', u'Etag': u'"4d10a5852032ca7f3dbb9a75f8282705"', u'x-goog-generation': u'1574748846214543', u'Cache-Control': u'private, max-age=0', u'Date': u'Tue, 26 Nov 2019 06:14:31 GMT', u'x-goog-hash': u'crc32c=WkZjfQ==, md5=TRClhSAyyn89u5p1+CgnBQ==', u'alt-svc': u'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000', u'Content-Type': u'application/json', u'x-guploader-uploadid': u'AEnB2Uq_miNpCaYZALnkxWsZiBKFWLXAy8X5bRMjcB6sm-AhQHtUvi6k5wgEDBgsDngur9_oaMtJPD25IAxz85UdvhavvaRpEQ', u'x-goog-storage-class': u'STANDARD'}
    Target OS version: 10.15.1
    Target OS subversion: 18G84
    Cleaning up temporary files...
    OS version sub build is higher or equal to the minimum threshold: 19A583

With "minimum_os_sub_build_version": specified in the config.json:

    Library/Application\ Support/nudge/Resources/nudge --jsonurl=ourURLhere
    Starting download: ourURLhere
    2019-11-25 22:43:31.821 Python[9779:5231104] URLSession_task_didReceiveChallenge_completionHandler_
    2019-11-25 22:43:31.822 Python[9779:5231104] Authentication challenge for Host: storage.googleapis.com Realm: None AuthMethod: NSURLAuthenticationMethodServerTrust
    2019-11-25 22:43:31.822 Python[9779:5231104] Allowing OS to handle authentication request
    Downloading nudge.json - Percent complete: 0
    Status: 200
    Headers: {u'x-goog-metageneration': u'1', u'Last-Modified': u'Tue, 26 Nov 2019 06:38:41 GMT', u'x-goog-stored-content-length': u'1581', u'Accept-Ranges': u'bytes', u'Expires': u'Tue, 26 Nov 2019 06:43:33 GMT', u'Content-Length': u'1581', u'Server': u'UploadServer', u'x-goog-stored-content-encoding': u'identity', u'Etag': u'"c9c08c78cc347bf94273764e4bbc93d7"', u'x-goog-generation': u'1574750321675888', u'Cache-Control': u'private, max-age=0', u'Date': u'Tue, 26 Nov 2019 06:43:33 GMT', u'x-goog-hash': u'crc32c=fYbyOw==, md5=ycCMeMw0e/lCc3ZOS7yT1w==', u'alt-svc': u'quic=":443"; ma=2592000; v="46,43",h3-Q050=":443"; ma=2592000,h3-Q049=":443"; ma=2592000,h3-Q048=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000', u'Content-Type': u'application/json', u'x-guploader-uploadid': u'AEnB2UpB5A9PQjzhUTyk_7ermoL0qwdgwzLLGetmYTKfm6aLKjQCpSSO1F67xde_1bJDOHlQsJHHrFiYgl8zoKco0v1MEAIjGA', u'x-goog-storage-class': u'STANDARD'}
    Target OS version: 10.15.1
    Target OS subversion: 19B88
    Cleaning up temporary files...
    OS version is below the minimum threshold: 10.15
    OS version is below the minimum threshold subversion: 19A583
    Timer is set to 7200.0

So without specifying the sub version, but the OS Version is lower than the Target OS version, the app just quits. If we specify the sub version, it works correctly, but, there might be times where you don’t want to include the sub version (for whatever reason).

@erikng has already confirmed that this is not intended/bug: https://macadmins.slack.com/archives/CDUU7DJQ2/p1574775141010000

Filing this so it is known, and if people search that there will be some record of it and also because I would love to try and fix this. I will try to schedule some time to mess with this and get it working in a better way. Will report back if I am unable.

erikng commented 4 years ago

this will be fixed in the upcoming python 3 version: https://github.com/erikng/nudge/tree/python38