Conversation
This comment was marked as outdated.
This comment was marked as outdated.
…ilding the url, instead of looking up the zone and url from a list. This allows for more flexibility and potential versioning of the end point.
72db510 to
47ce914
Compare
This comment was marked as outdated.
This comment was marked as outdated.
|
cc @Lunik @guillaume_ro_fr |
This comment was marked as outdated.
This comment was marked as outdated.
felixfontein
left a comment
There was a problem hiding this comment.
Thanks for your contribution!
russoz
left a comment
There was a problem hiding this comment.
Thanks for your contribution! Couple of comments.
plugins/modules/scaleway_ip_info.py
Outdated
| - Scaleway region to use (for example C(par1)). | ||
| required: true | ||
| - Scaleway region to use (for example V(par1)). | ||
| required: false |
There was a problem hiding this comment.
required=false is redundant both here and in the arg specs
There was a problem hiding this comment.
Yup, good call. Sorted them as well.
|
Oh and please add a changelog fragment. |
|
Also please note that the extra tests are failing. |
|
Thanks for the feedback, I really appreciate it. |
russoz
left a comment
There was a problem hiding this comment.
Oops, sorry I didn't see this in time.
In any case, LGTM
|
Apologies for the delay in updating this. I have added a change record for a I think that's everything covered here. Please let me know if there is something I've missed :) |
| @@ -0,0 +1,2 @@ | |||
| minor_changes: | |||
| - scaleway_ip_info - now accepts a ``zone`` parameter, detailing the Scaleway zone to use in the lookup. This is mutually exclusive of the existing ``region`` parameter (https://github.com/ansible-collections/community.general/issues/11351). | |||
There was a problem hiding this comment.
| - scaleway_ip_info - now accepts a ``zone`` parameter, detailing the Scaleway zone to use in the lookup. This is mutually exclusive of the existing ``region`` parameter (https://github.com/ansible-collections/community.general/issues/11351). | |
| - scaleway_ip_info - now accepts a ``zone`` parameter, detailing the Scaleway zone to use in the lookup. This is mutually exclusive of the existing ``region`` parameter (https://github.com/ansible-collections/community.general/issues/11351, https://github.com/ansible-collections/community.general/pull/11629). |
There was a problem hiding this comment.
And there should be entries for the changes in all the modules below.
|
|
||
| def send(self, method, path, data=None, headers=None, params=None): | ||
| url = self._url_builder(path=path, params=params) | ||
| self.warn(url) |
There was a problem hiding this comment.
I guess this is a bugfix? If yes, it should be mentioned in bugfixes: in the changelog fragment.
There was a problem hiding this comment.
Personally I don't think adding/removing log messages should count as a bugfix.
Now instead of removing this entirely, it might be worth replacing that with:
| self.warn(url) | |
| self.debug(url) |
There was a problem hiding this comment.
Showing the URL queried as a warning (which is likely very annoying to users of the modules) looks like forgotten debug code, and removing that would count (and should be announced to the users) as a bugfix IMO.
There was a problem hiding this comment.
I thought it looked like left over debugging code that wasn't removed. The fact that it just randomly prints the url being used inside the ansible logs without any context seemed to support this.
Changing this to self.module.debug() seems to be the preferred option from this module (and the rest of the codebase). I'll change it to that.
I did try to change it to use the verbosity flag of the ansible task (using display.vv() etc), but for some reason the library wasn't working on my environment. From what I read it's something to do with the underlying ansible-core library so debug() is probably the way to go (at least for now).
russoz
left a comment
There was a problem hiding this comment.
Thanks for your continued efforts here. 12.5.0 has left the building last week.
The new region in Italy is definitely something that could/should be backported to -12 and to -11, IMHO. That would be a bugfix.
The other changes would likely fall in the minor_changes category.
Not sure it's worth the effort of splitting this in two though.
plugins/modules/scaleway_ip_info.py
Outdated
| type: str | ||
| description: | ||
| - Scaleway zone to use (for example V(nl-ams-1)). | ||
| version_added: 12.5.0 |
There was a problem hiding this comment.
That ship has sailed
| version_added: 12.5.0 | |
| version_added: 12.6.0 |
In the past, we alwasy treated new regions as a new feature. |
russoz
left a comment
There was a problem hiding this comment.
another couple of comments
|
|
||
| def send(self, method, path, data=None, headers=None, params=None): | ||
| url = self._url_builder(path=path, params=params) | ||
| self.warn(url) |
There was a problem hiding this comment.
Personally I don't think adding/removing log messages should count as a bugfix.
Now instead of removing this entirely, it might be worth replacing that with:
| self.warn(url) | |
| self.debug(url) |
| @@ -0,0 +1,2 @@ | |||
| minor_changes: | |||
| - scaleway_ip_info - now accepts a ``zone`` parameter, detailing the Scaleway zone to use in the lookup. This is mutually exclusive of the existing ``region`` parameter (https://github.com/ansible-collections/community.general/issues/11351). | |||
There was a problem hiding this comment.
And there should be entries for the changes in all the modules below.
…thod of the Scaleway class.
…_ip_info module to 12.6.0.
|
So should I remove all of the updates for the new region and create a new issue for that? Sorry, I saw the new region being added and thought I would include it, but I can always remove it and create a separate issue for it if that is best? If not, I'll get the change records updated for this PR. |
|
I'd sayit hinges on the verdict for that If it becomes a bugfix, then the region add should go to a different PR. |
|
Why not simply move the |
|
well, that would make life much easier :-) |
SUMMARY
Following on from discussions in the ticket #11351 I have refactored the main scaleway.py class and the scaleway_ip_info module to use "zone" ID, rather than zone names over the old "region" argument. In addition, it's best to move to a system where the URL is constructed, rather than hard coded.
I have added some logic (through annotations) to allow either zone or region to be used, region still functions in the same way as it always has, but will now issue a deprecation warning.
Since the IP info module is a information only module I've selected this as the starting point for refactoring the scaleway modules in this project. They all use different styles of code and make use of the aforemenionted hard coded URLs list.
Whilst I was there, I've also added the new zone that Scaleway have to the main scaleway.py class.
ISSUE TYPE
COMPONENT NAME
scaleway_ip_info
ADDITIONAL INFORMATION
New usage of the scaleway_ip_info module is as follows: