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

General CI Fix #573

Merged
merged 25 commits into from
Sep 13, 2021
Merged

General CI Fix #573

merged 25 commits into from
Sep 13, 2021

Conversation

ryanmerolle
Copy link
Contributor

@ryanmerolle ryanmerolle commented Aug 5, 2021

Closes Issue #567

  • Corrects integration testing failures because mismatched netbox-docker and NetBox version related to latest assuming v2.11 for both repos (NetBox 3.0.x release broke that logic)
  • Correct sanity checks related to missing cert references
  • Correct sanity checks related to tags (type: list) not having a element defined
  • Removed unneeded ignore references to parameter-list-no-elements that were causing CI to fail
  • Introduce but commented out NetBox v3.0 integration testing

sc68cal
sc68cal previously approved these changes Sep 8, 2021
@felixfontein
Copy link

The PR #534 which added this option (but failed to document them) was also missing version_added for all the new options added. It's probably a good idea to also add that in this PR.

@nahun
Copy link
Contributor

nahun commented Sep 9, 2021

>       cert = self.module.params["cert"]
E       KeyError: 'cert'

I believe its because cert doesn't have a default value so it doesn't get set in module params. But I could easily be wrong

I noticed this too on:

session.cert = tuple(i for i in cert)

All modules fail because cert is None if the user doesn't provide that parameter in their task and it can't loop on None.

@felixfontein
Copy link

@nahun all module options have the implicit default None. This failure happens in the tests because the tests have a hard-coded fake params dictionary: https://github.com/netbox-community/ansible_modules/blob/devel/tests/unit/module_utils/test_netbox_base_class.py#L79

@ryanmerolle ryanmerolle changed the title add cert option to module documentation CI Fix Sep 11, 2021
@felixfontein
Copy link

@ryanmerolle adding "cert": None, to

return {
"netbox_url": "http://netbox.local/",
"netbox_token": "0123456789",
"data": {
"name": "Test Device1",
"device_role": "Core Switch",
"device_type": "Cisco Switch",
"manufacturer": "Cisco",
"site": "Test Site",
"asset_tag": "1001",
},
"state": "present",
"validate_certs": False,
}
should fix the remaining issues, resp. at least proceed them a bit longer until failure :)

@ryanmerolle
Copy link
Contributor Author

Thanks for the pointer @felixfontein. I felt like playing whack a mole with each CI linting_unit_testing stage Error I would find as I would fix each one. I just got tired and had to call it quits for the night. ON to the integration testing errors now.

@ryanmerolle
Copy link
Contributor Author

@FragmentedPacket I got a lot of the CI fixed up, but could I bother you this once to review? Totally understand if not.

Summary: I got us unblocked for lint unit testing but hitting some snags on integration testing.

@rodvand
Copy link
Contributor

rodvand commented Sep 11, 2021

As @nahun mentioned earlier the line

session.cert = tuple(i for i in cert)
is troublesome when cert is None. So I suggest we just do a simple

if cert:
    session.cert = tuple(i for i in cert)

to avoid the issue. The cert addition to the modules does need a more thorough walkthrough I think when things have "settled" a bit.

@ryanmerolle
Copy link
Contributor Author

ryanmerolle commented Sep 12, 2021

All that is left is either skipping v3.0 integration requiring success or fixing the integration testing for 3.0.

Of course I need to document all the changes since this became a bigger PR than I intended.

@nahun
Copy link
Contributor

nahun commented Sep 12, 2021

I say we let 3.0 fail for now as we haven't done any real work for 3.0 yet.

Great work!

@rodvand
Copy link
Contributor

rodvand commented Sep 12, 2021

I agree. 3.0 support should be a separate PR.

@ryanmerolle
Copy link
Contributor Author

I am commenting out NetBox 3.0 CI.

I agree on it being its own PR, but at the same time it was so close and no major API changes were introduce, so it should not be failing.

Future PRs should address:

  • Tests for current ansible-core and previous major version (ansible-base in the case of 2.10).
  • Any new Ansible requirements with regard to continuing the collection inclusion with the "fat" ansible install.
  • NetBox 3.0 testing.
  • Cleanup of old references in integration and unit tests (python2, old netbox versions below 2.11, etc).
  • Local CI & contribution documentation updates. The current barrier to entry on updating CI or running CI locally is quite high, and I only go this far due to my more than average involvement in the netbox-docker repo and its deployment in my own job.

@ryanmerolle
Copy link
Contributor Author

@jeremystretch Ready to Merge...

@jeremystretch jeremystretch merged commit a7cb32f into netbox-community:devel Sep 13, 2021
@gundalow
Copy link
Contributor

Thanks :)

@ryanmerolle ryanmerolle changed the title CI Fix General CI Fix Sep 20, 2021
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.

7 participants