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

Various updates, will squash with more meaningful message later #577

Merged
merged 29 commits into from
Sep 15, 2023

Conversation

itdependsnetworks
Copy link
Contributor

No description provided.

@mzbroch
Copy link
Contributor

mzbroch commented Sep 11, 2023

Now that we have PLAN/DEPLOY settings , can we auto-enable related jobs from plugin init as suggested in nautobot/nautobot#4398 (comment) (only if already enabled through settings) ?

@joewesch
Copy link
Contributor

joewesch commented Sep 11, 2023

These warnings are showing up on all Config Plan views. Should these warnings be isolated to the view they are actually used?

Generate Config Plans > Config Plan Create
Deploy Config Plans > Config Plan List
Deploy Config Plan (Job Button Receiver) >  Config Plan Detail View

Screenshot 2023-09-11 at 9 50 15 AM

@itdependsnetworks
Copy link
Contributor Author

These warnings are showing up on all Config Plan views. Should these warnings be isolated to the view they are actually used?

I personally found it confusing it was scoped to just the create. Fail early, fail often... what do you guys think?

@joewesch
Copy link
Contributor

joewesch commented Sep 11, 2023

If you disable generate then there will be nothing to deploy. Having the ability to enable deploy without generate would not work and cause confusion. Maybe combine them into one setting or throw a warning when they disable generate but not deploy?

@mzbroch
Copy link
Contributor

mzbroch commented Sep 11, 2023

If you disable generate then there will be nothing to deploy. Having the ability to enable deploy without generate would not work and cause confusion. Maybe combine them into one setting or throw a warning when they disable generate but not deploy?

Following use cases are valid :

  1. As a user , I want to generate a plan in Nautobot and deploy it with a different tool - manually, Ansible/AWX, etc.

  2. As a user , I want to post a custom Config PLAN through the API (type manual) , and perform change approval to later either deploy with Ansible/AWX/manually/Nautobot.

@mzbroch
Copy link
Contributor

mzbroch commented Sep 11, 2023

These warnings are showing up on all Config Plan views. Should these warnings be isolated to the view they are actually used?

Generate Config Plans > Config Plan Create
Deploy Config Plans > Config Plan List
Deploy Config Plan (Job Button Receiver) >  Config Plan Detail View

Screenshot 2023-09-11 at 9 50 15 AM

I will stay in a position , where Job should be automatically enabled by the plugin's ORM if settings are set to "ENABLE". This will improve user experience and decrease complexity

@joewesch
Copy link
Contributor

As a user , I want to generate a plan in Nautobot and deploy it with a different tool - manually, Ansible/AWX, etc.

This is if generate is enabled and deploy is disabled. I did not speak on this use case and it is still valid.

As a user , I want to post a custom Config PLAN through the API (type manual) , and perform change approval to later either deploy with Ansible/AWX/manually/Nautobot.

The POST method is intentionally disabled for the API view on config plans as they should be generated via Job:
https://github.com/nautobot/nautobot-plugin-golden-config/blob/6d8326762cf4be1d152346293edbfebe84c13d18/nautobot_golden_config/api/views.py#L134-L135

@jeffkala
Copy link
Contributor

These warnings are showing up on all Config Plan views. Should these warnings be isolated to the view they are actually used?

I personally found it confusing it was scoped to just the create. Fail early, fail often... what do you guys think?

Only thing to me that is now confusing with these warnings, is that we don't warn for an identical scenario for the other "featuers" that GC has. We don't warn that backup jobs, intended, etc. are not enabled. I know the scope is slightly different because some of these are hidden. But just curious what others think on this note.


def receive_job_button(self, obj):
"""Run config plan deployment process."""
self.log_debug("Starting config plan deployment job.")
data = {"debug": False, "config_plan": ConfigPlan.objects.filter(id=obj.id)}
config_deployment(self, data, commit=True)
if not self.failed:
obj.delete()
obj.update(status=Status.objects.get(slug="completed"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to update the config_deployment nornir play to now fail if any of the plans are Completed. We don't want to deploy the same config plan twice.

Copy link
Contributor

@mzbroch mzbroch Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think You could gracefully skip implemented tasks. In the longer-run , we could discuss how to present archive config plans (maybe second List View ?)

In this implementation , you can have three stages :

  • start (status planned)
  • inprogress (status in-implementation)
  • finish (status implemented / errored)

Ideally, You can only start tasks in a certain status : planned or failed.
Tasks in progress (during implementation) should also change status to in-progress for the duration of the actual job
Tasks finalised: either deployed (implemented), either "errored"

STATE_MACHINE = {
    "start": {
        "provision": ["Planned", "Failed", "Decommissioned"],
        "deprovision": ["Active", "Failed"],
    },
    "inprogress": {
        "provision": "Provisioning",
        "deprovision": "Deprovisioning",
    },
    "finish": {
        "provision": "Active",
        "deprovision": "Decommissioned",
    },
}

"graphql",
"relationships",
"webhooks",
Copy link
Contributor

@mzbroch mzbroch Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason we had only graphql was the GoldenConfigSetting model :

@extras_features(
    "graphql",
)
class GoldenConfigSetting(PrimaryModel):  # pylint: disable=too-many-ancestors

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, I think that was an oversight as well. Will fix in 2.0

joewesch and others added 3 commits September 13, 2023 21:06
* Adds URL validation to Config Plan creation form

* Update nautobot_golden_config/templates/nautobot_golden_config/configplan_create.html

---------

Co-authored-by: Jeff Kala <[email protected]>
…nternet to pull form nautobot core static which fixes #585 (#587)

* fix dynamic status changes during deployment

* fixes filters on empty results from erroring

* few additional cleanups

* run black

* remove unused import

* change jquery from internet to pull form nautobot core static, fixes #585
…d documentation(#589)

* some flake8 fixes

* fix broken flake8 and pylint configs and actual issues, and update run_job.js

* add ADRs

* add documetnation
@mzbroch
Copy link
Contributor

mzbroch commented Sep 14, 2023

Issue within template :
Screenshot 2023-09-14 at 16 28 15

@mzbroch
Copy link
Contributor

mzbroch commented Sep 14, 2023

Screenshot 2023-09-14 at 16 34 03

In the Config Plan List view, there is a "Job Result" column. In most cases, users will be interested in seeing the deployment result, and what is presented to them is the result from the job creating the config plan

Screenshot 2023-09-14 at 16 35 48

Comment on lines -870 to -871
null=False,
blank=False,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am still not sure about this change.

We decided to generate config plans with job-helper, however we ended-up:

  • disabling CSV imports of config plans
  • disabling API creation of config plans

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing has functionally changed

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was saying , that the ConfigPlan model makes the jobID mandatory - you cannot have ConfigPlan without having a Job first.
The only one point I am making today is that we can possibly have more ways of populating this in the future - CSVs , APIs etc.

Copy link
Contributor

@mzbroch mzbroch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines 941 to 942
Job.objects.get(module_name="nautobot_golden_config.jobs", job_class_name="GenerateConfigPlans"),
request,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to use string-ified imported elements here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure about the request or the benefits, do you mind explaining further?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking we could avoid re-typing class names, possibly making it harder to make mistake in the future.

@jeffkala
Copy link
Contributor

Screenshot 2023-09-14 at 16 34 03 In the Config Plan List view, there is a "Job Result" column. In most cases, users will be interested in seeing the **deployment** result, and what is presented to them is the result from the job creating the config plan Screenshot 2023-09-14 at 16 35 48

played with this for awhile, but ultamietly its just all "completed" since if a ConfigPlan job creation fails the configplan itself isn't ever created.

Example of what it looks like, but not sure it would ever be anything other than completed.
Screenshot 2023-09-14 at 11 47 50 PM

@mzbroch
Copy link
Contributor

mzbroch commented Sep 15, 2023

played with this for awhile, but ultamietly its just all "completed" since if a ConfigPlan job creation fails the configplan itself isn't ever created.

Example of what it looks like, but not sure it would ever be anything other than completed. Screenshot 2023-09-14 at 11 47 50 PM

This is exactly my point -
Screenshot 2023-09-15 at 08 17 02

impression is , that actual "deployment" is completed. (once the configPlan has been created, the "Job Result" of creating the object is not the most important)

@jeffkala
Copy link
Contributor

played with this for awhile, but ultamietly its just all "completed" since if a ConfigPlan job creation fails the configplan itself isn't ever created.
Example of what it looks like, but not sure it would ever be anything other than completed. Screenshot 2023-09-14 at 11 47 50 PM

This is exactly my point - Screenshot 2023-09-15 at 08 17 02

impression is , that actual "deployment" is completed. (once the configPlan has been created, the "Job Result" of creating the object is not the most important)

Have a fix for this i'm finalizing.

joewesch and others added 3 commits September 15, 2023 11:04
* implement plan_result and deploy_result

* change cascade to protect

* Update nautobot_golden_config/nornir_plays/config_deployment.py

Co-authored-by: Joe Wesch <[email protected]>

* fix filter and typo

---------

Co-authored-by: Joe Wesch <[email protected]>
@itdependsnetworks itdependsnetworks merged commit 838a01c into develop Sep 15, 2023
@itdependsnetworks itdependsnetworks deleted the wg-kc-update branch October 2, 2023 03:06
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.

4 participants