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

Initiating Nautobot jobs #224

Closed

Conversation

MeganerdDev
Copy link
Contributor

@MeganerdDev MeganerdDev commented Jul 31, 2023

Closes: #223

What's Changed

  • Adds init_job subccomand which initiates a Nautobot job by job name

Remaining work

  • The acceptance criteria of this PR would require mapping of the username of the user interacting with the chatbot to the username of the user in Nautobot
  • The render markdown is incomplete, the present output is a placeholder
  • Add supporting subcommand: get_jobs
  • Add to documentation

TODO

  • Explanation of Change(s)
  • Added change log fragment(s) (for more information see the documentation)
  • Attached Screenshots, Payload Example
  • Unit, Integration Tests
  • Documentation Updates (when adding/changing features)
  • Outline Remaining Work, Constraints from Design

Notes

  • Tested to be working from ChatOps+Mattermost but must statically set the user the job runs as
  • Adding a parameter for the user is possible but seems non-preferred solution
  • We could also initiate jobs from API, but the ORM makes more sense?

@MeganerdDev
Copy link
Contributor Author

Also, I used init_job since the run_job namespace is already being used by core, and changing the import run_job as something_else seemed like bad practice.

meganerd added 4 commits July 31, 2023 15:22
+ Add changelog fragment
- Removed unused imports
- Conform to variable naming style
@MeganerdDev
Copy link
Contributor Author

@smk4664 @jvanderaa

@smk4664
Copy link
Contributor

smk4664 commented Sep 19, 2023

We now have the ability to get the Username of the Nautobot user from the chat platform in Next-2.0. Would you mind refactoring this against next-2.0? It would also be nice to ensure the user has permission to run jobs, and limit the list of jobs to jobs they have access to.

smk4664 and others added 3 commits September 23, 2023 07:02
…permission mapping

Add get_jobs class method which returns table of jobs, which can be filtered
Update queries to use restrist filter for user
@MeganerdDev MeganerdDev changed the base branch from develop to next-2.0 September 25, 2023 07:11
@MeganerdDev
Copy link
Contributor Author

I moved the base for the merge to next-2.0

@MeganerdDev
Copy link
Contributor Author

I need to test this to confirm working as expected! I followed the pattern I believed was proper however.

I am blocked by an issue getting my homelab up for testing this. Does this look like user error for my homelab?
I am on Chatops next-2.0 branch (3.0.0rc1) with Nautobot v2.0.0rc3
To rule out nautobot as the issue I ran migrate, post_upgrade, collectstatic
image

MeganerdDev pushed a commit to MeganerdDev/nautobot-plugin-chatops that referenced this pull request Sep 26, 2023
MeganerdDev pushed a commit to MeganerdDev/nautobot-plugin-chatops that referenced this pull request Sep 26, 2023
@MeganerdDev
Copy link
Contributor Author

Hi @smk4664, I updated and tested this feature on #270 to be working (outside of some noted edge cases)

I was having some GIT troubles rebasing this to next-2.0 properly and didn't have the time to fit GIT. Hope that is okay! I modified the fragment and all.

@MeganerdDev
Copy link
Contributor Author

closed in favor of #270

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.

Start Nautobot jobs from Nautobot subcommand
4 participants