Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "postware" #851

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Add "postware" #851

wants to merge 1 commit into from

Conversation

jessepeterson
Copy link
Contributor

"Postware" is like middleware but gets called when file downloads are completed.

@jessepeterson
Copy link
Contributor Author

Created largely in support of https://github.com/jessepeterson/signware

@@ -70,14 +70,13 @@
munki_version, darwin_version)


def import_middleware():
'''Check munki folder for a python file that starts with 'middleware'.
def import_middleware(file_prefix='middleware', globals_prefix='middleware', required_function_name='process_request_options'):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run your changes through a PEP-8 checker; this line is definitely over 80 characters...

if postware:
display.display_debug2('Processing options through postware')
# postware module must have process_post_fetch function
postware.process_post_fetch(url, destinationpath)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the item is unchanged, the signature was checked during the initial download (unless you've just switched to checking signatures). Is there a good reason to check the signature again?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the idea was that if the signature changed but the download itself hadn't (or vice-versa; basically just always try and check, rather than assuming too much), that we should re-run the postware (in the case of the signature-checking). Due to the fact we place it in a temp file the signature is always re-downloaded, however. Perhaps another postware function should be called (or a different argument/option supplied to the function to indicate the separate calls)? Or perhaps we should save the signaures along-side the cats/manifests? This way we could not download them over and over again.

I don't want the "postware" to be exclusively for signature checking - hopefully it's generic enough for other use cases, too.

@gregneagle gregneagle closed this Jun 15, 2020
@gregneagle gregneagle reopened this Jun 16, 2020
@gregneagle gregneagle changed the base branch from master to main June 16, 2020 04:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants