On 20/05/2010 2:53 AM, Greg Neagle wrote:
> On May 19, 2010, at 2:30 AM, Rob Middleton wrote:
>
>
>> 2. Further digging shows a related bug -- in the case of a 404 error but there is a previously downloaded file, Munki will use the previous file so long as the previous file parses as a valid plist.
>>
>>
>> def getHTTPfileIfChangedAtomically(url, destinationpath,
>> message=None, resume=False):
>> ...
>> return destinationpath, err
>> # in this function, destinationpath is returned even if there was a failure. The only case destinationpath = None is returned is where no previous file existed at that location.
>>
>> That function called by --
>> def getCatalogs(cataloglist):
>> ...
>> (newcatalog, err) = getHTTPfileIfChangedAtomically(catalogurl,
>> catalogpath,
>> message=message)
>> if newcatalog:
>> # this function assumes that if newcatalog != None that a valid download occurred - this is not true, it could mean a 404 error but a previously downloaded file.
>>
>> [outcome - if that catalog is now empty, Munki will use the last previously cached non-empty catalog]
>>
> I need to think about this a bit; the original intention was to have managedsoftwareupdate _not_ fail when it couldn't download things from the munki server, so that it could continue on and possibly install things that had been previously downloaded. Here's the scenario:
>
> 1) managedsoftwareupdate runs while a laptop is on the organization's network and it downloads some items to be installed. A user is logged in however, and elects not to install at that time.
>
> 2) The user takes the laptop home. managedsoftwareupdate runs again, cannot contact the munki server, but continues on and sees pre-downloaded items ready to be installed. If a user is logged in, they might be notified at this time; otherwise we go ahead and install.
>
> So I try to proceed as much as possible even if I cannot get things from the munki server, but there are probably logic errors due to this... This seems to be one.
>
I agree, not straight forward.
A 404 error is almost a clear "no longer on the server / should no
longer be on the client" directive ... at least for HTTPS. There is
still a problem of a laptop connecting to a wireless network through a
captive portal (wireless login/payment page) - you may not be talking to
the real webserver, so deleting the file on a 404 that has been
generated by an intercepting web server is problematic. But perhaps that
is just an argument for only supporting https for manifest and catalog
files :-).
>> 3. An unimportant imperfection is that the failed-to-download catalog will be reattempted for download for every nested manifest processed. Each manifest processed will call getCatalogs(cataloglist) for all relevant catalogs. If a valid catalog is already loaded it will not download it again (catalogname in catalog), if the catalog failed to download for the last manifest a download attempt will again be made.
>>
>> def getCatalogs(cataloglist):
>> ...
>> for catalogname in cataloglist:
>> if not catalogname in catalog:
>> ....
>> (newcatalog, err) = getHTTPfileIfChangedAtomically(catalogurl,
>> catalogpath,
>> message=message)
>>
> I consider the case of a non-existent catalog in a manifest a mistake on the part of the munki admin. We don't want managedsoftware update to crash in the is case, but we don't need to spend any effort optimizing for this case, either. Do you disagree? In this case, the fix is simple -- the admin should remove the reference to the non-existent catalogs from the manifests, or populate the non-existent catalog!
>
> I suppose I could just build an empty catalog dictionary for non-existent catalogs, which would prevent the reattempted downloads...
>
I think in my first email I suggested this alternate (or additional)
solution of allowing makecatalogs to take a list of catalogs that need
to exist. The mistake isn't so much on the part of the munki admin when
we can't give the tools the right parameters yet :-), makecatalogs wipes
out my empty catalogs. The question then is whether makecatalogs just
takes the catalog list on the command line (my preference), or whether
it parses the manifest directory to find the list of catalogs that
should exist.
It should be fairly normal for the testing catalog to be empty. A
pkginfo is either pushed to production within 2 days or removed from
testing ... if no more packages are loaded for 2 weeks the testing
catalog might be empty (or missing) for 12 days. The manifests should
not need to be modified in this case, they are hand coded unlike the
catalogs.
Cheers,
Rob Middleton.
>
>> Slowly getting my head around the code. I still haven't got my head around the nice curl wrapper. I like the use of extended attributes to store the etag.
>>
> That solution made me happy, since I didn't have to make some other structure to keep track of Etags.
>
> -Greg
>
>
>> Regards,
>> Rob Middleton.
>>
>> On 19/05/2010, at 2:33 AM, Greg Neagle wrote:
>>
>>
>>> I wasn't able to reproduce your exact error, but did see a series of other errors caused by non-existent catalogs.
>>>
>>> Replace your /usr/local/munki/munkilib/updatecheck.py with this one:
>>>
>>>
http://munki.googlecode.com/svn-history/r537/trunk/code/client/munkilib/updatecheck.py
>>>
>>> and see if it addresses your issue as well.
>>>
>>> -Greg
>>>
>>> On May 17, 2010, at 11:37 PM, Rob Middleton wrote:
>>>
>>>
>>>> Unsure about 0.5.0. I only got munki setup properly for testing on Sunday. I needed the time& the curl munki - verifying server certs is important to me (thanks for that change).