Repository navigation
Allowing custom timeouts for Manage.up(), Test.ping() and on a generic LocalCall - #195
Conversation
|
Looks good to me, only thing missing are junit tests (which can be trivial). |
|
Tests added, this also LGTM. Assigning to @lucidd to get his ultimate approval. |
| arg.ifPresent(arg -> payload.put("arg", arg)); | ||
| kwarg.ifPresent(kwarg -> payload.put("kwarg", kwarg)); | ||
| metadata.ifPresent(m -> payload.put("metadata", m)); | ||
| timeout.ifPresent(timeout -> payload.put("timeout", timeout)); |
There was a problem hiding this comment.
is timeout and gather_job_timeout supported on every local_* client?
There was a problem hiding this comment.
Well, these two parameters are now handled inside salt.client.LocalClient class of Salt, which is the class that handles all local_* clients.
The local, local_async clients will work as expected, but looking now at local_batch in the Salt side, it seems that kwargs won't be propagated to the Batch object so I'll expect that timeouts parameters won't work on this case. I'll fix this on Salt ASAP. Thanks! 👍
There was a problem hiding this comment.
I would say that the Batch case should be fixed in Salt, as ATM it is a Salt bug. That should not block this PR anyway, as the library is doing the right thing FMPOV.
Is that OK with you @lucidd?
There was a problem hiding this comment.
if it will be fixed in salt then its ok. Only in case it will not or cant be fixed in salt we should make sure in the library that you cant end up configuring something that will never work the way you expect.
There was a problem hiding this comment.
@lucidd - This PR fixes local_batch client: saltstack/salt#40300
| return PING; | ||
| } | ||
|
|
||
| public static LocalCall<Boolean> ping(Optional<Integer> timeout, |
There was a problem hiding this comment.
i don't think we should make ping a special case here if those parameters are supported on every function. We should rather do something along the lines of withMetadata.
There was a problem hiding this comment.
For the record, we discussed this with @meaksh and he will adjust this PR as per your suggestion. Thanks
| } | ||
|
|
||
| public static RunnerCall<List<String>> up(Optional<Integer> timeout, | ||
| Optional<Integer> gatherJobTimeout) { |
There was a problem hiding this comment.
is there a semantical difference between the parameters to up and the now generally introduced ones?
There was a problem hiding this comment.
No, their semantics are the same - but in this case we cannot introduce this in a general way for all RunnerCalls, simply because those two parameters have been added "ad hoc" for manage.up and manage.status.
@lucidd: is it OK to add them as Optionals or would method overloading make more sense here to be backwards compatible?
There was a problem hiding this comment.
Using Optional in most module functions is more because of lazyness. Overloading is always preferred but gets quickly out of hand in case of many optional parameters. We don't promise backwards compatibility before 1.0 but if its easy to provide in this case we should go for it.
|
@lucidd - Thank you for your feedback in this PR. I've added a few more commits to address the discussion here:
Please, take a look when you have time. Still pending to fix the Batch issue. I would expect a PR to upstream Salt in the following days since I pointed this out in a Trello card. UPDATE: |
This PR allows to set custom
timeoutandtimeout_job_timeoutsalt attributes when callingManage.up(),Test.ping()or a genericLocalCall.This is very useful when some minions are unreachable and we want to get a presence report in a short and fixed amount of time.
Salt upstream PR: saltstack/salt#40018