Add 'noaction' flag for install/remove in the opkg execution module #50306
Conversation
Signed-off-by: Rares POP <rares.pop@ni.com>
isbm
left a comment
There was a problem hiding this comment.
But why? Isn't that we have test=True for this instead?
@cachedout while code looks OK, it is conceptually weird. This should be incorporated with the test=True instead.
|
@isbm - I am not aware of test=True. What is it? I browsed dpkg.py and apk.py and I haven't seen anything interesting. Are you saying that we shouldn't go with 'noaction' since that's very opkg specific and say 'test' instead? |
|
@rares-pop this is a test mode, like dry run. This is not really working if module does not respects that (and you also don't know it does respect it or not...). Still this is how Salt is dealing here as of today. Basically, you're looking for |
|
@isbm - opts is the minion configuration, right? Can you specify that option (opts['test']) on a salt-call basis? i.e. the sequence: |
Generally, you should be able to incorporate this with the testing mode, described here: |
|
@isbm - I don't want to go through state modules. I need to do a simple salt-call --local and pass that argument. salt-call doesn't seem to put its arguments inside opts, but only in kwargs. Can you be more specific on how I can achieve that with what you suggest (directly on the minion, possibly a masterless minion)? |
|
First of all, you have to. 😉 It is a virtual module that is also used in states. So if Second, if you want that also in the module call it do nothing, then just add |
|
@isbm - sorry for the back and forth, but just to be sure to implement the correct thing:
Is that correct? If that's correct, if things contradict (opts['test'] = False but kwargs contain test=True'), which should have priority? Probably opts if it's set to true, otherwise kwargs if present? |
Then just pull "test" out of them: if bool(kwargs.get('test') or __opt__.get('test')):
cmd_prefix.append('--noaction') |
Be compliant with Salt's terminology Signed-off-by: Rares POP <rares.pop@ni.com>
…salt into dev/iepopr/opkg-noaction-flag
Signed-off-by: Rares POP <rares.pop@ni.com>
Keep 'noaction' in the test name since test_install_test sounds wrong. Signed-off-by: Rares POP <rares.pop@ni.com>
|
Oops.. I kept the 'noaction' in the test name, because that's really what it should happen, even if the actual parameter is 'test=True'. More than that, test_install_test sounds weird. |
Signed-off-by: Rares POP <rares.pop@ni.com>
| return ret | ||
|
|
||
|
|
||
| def _append_noaction_if_testmode(cmd, **kwargs): |
There was a problem hiding this comment.
You can call it just _noaction 😉 but this is also OK.
[master] Porting #50306 to master
What does this PR do?
Adding the 'noaction' flags when installing/removing software. Basically it's just testing if the operations will succeed or not without actually doing the operation.
Previous Behavior
opkg wasn't providing this functionality.
New Behavior
you can pass the noaction=True flag
Tests written?
Yes
Commits signed with GPG?
Yes