macadmins / installapplications

A tool for dynamically using installapplication
Apache License 2.0
286 stars 62 forks source link

Move the main loop that processes itemsToProcess to a function #98

Closed thehilll closed 3 years ago

thehilll commented 3 years ago

Move the main loop that processes itemsToProcess (after parsing CLI args) and construction of stages dict out to a function.

The function takes only the itemsToProcess list that is constructed by parsing the args.item inputs as well as the base-url.

Within the function the code is essentially unchanged, and the function returns the completed stages dictionary.

The only other change is to remove the branch "if args.output" when constructing the savePath...args.output is required, so it will always be set (also, the alternative 'rootdir' appears to not be defined).

This version is updated to handle the newly added pkg-skip-if settings.

thehilll commented 3 years ago

Just wanted to follow up and see if you think any changes are needed here. Thanks.

erikng commented 3 years ago

Looks good but my only question is does this change any of the current behaviors? In other words is this is a breaking change?

thehilll commented 3 years ago

No, it isn't breaking.

I just moved the work that you do after building the itemsToProcess list into a function. Your wiki instructions to call generatejson.py via cli should not need to change at all.

The improvement is that it is easier to use this as part of a larger process now, by including from generatejson import *, building a list that matches itemsToProcess and then calling the new function build_item_dict. Previously we had done this by using subprocess to mimic what you describe in the wiki, but that just seemed like a bit of a hack.

Thanks again for making this. It has been extremely valuable for us.

erikng commented 3 years ago

Clever. :)

erikng commented 3 years ago

Thanks for the PR. Merged.