-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: ✨ Decommissioning Job #85
Conversation
…iltin `indent` filter
examples/backbone_design/designs/core_site/designs/0001_design.yaml.j2
Outdated
Show resolved
Hide resolved
nautobot_design_builder/jobs.py
Outdated
# TODO: how to make this more decoupled? | ||
self.log_info( | ||
f"Checking if the design instance {design_instance} can be decommissioned by external dependencies." | ||
) | ||
self.log_success(f"No dependency issues found for {design_instance}.") | ||
return True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is not the final implementation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, the decoupling has to happen in this PR. any suggestion?
nautobot_design_builder/jobs.py
Outdated
content_type = ContentType.objects.get_for_model(DesignInstance) | ||
design_instance.status = Status.objects.get( | ||
content_types=content_type, name=DesignInstanceStatusChoices.DECOMMISSIONED | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
content_type = ContentType.objects.get_for_model(DesignInstance) | |
design_instance.status = Status.objects.get( | |
content_types=content_type, name=DesignInstanceStatusChoices.DECOMMISSIONED | |
) | |
design_instance.status = Status.objects.get( | |
name=DesignInstanceStatusChoices.DECOMMISSIONED | |
) |
This should be the same, shouldn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
likely. I guess a Status can't have the same name and belong to a different content_type. will check
Co-authored-by: Leo Kirchner <[email protected]>
fix: Updates for OSRB documentation review
Updates pyproject.toml for 3.11
nautobot_design_builder/jobs.py
Outdated
try: | ||
func = import_string(pre_decommission_hook) | ||
except ImportError as error: | ||
msg = ( | ||
"There was an issue attempting to import the pre decommission hook " | ||
f"{pre_decommission_hook}, this is expected with a local configuration issue and not related to" | ||
" the Design Builder App, please contact your system admin for further details.\n" | ||
) | ||
raise ValueError(msg + str(error)) from error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this approach - does it make sense/is it possible to instead just pass the callable directly? I.e. have the settings import it and then just use it here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it would make it easier. I will try it.
The `TransactionTestCase` actually has less test isolation than `TestCase` which caused the test designs to not actually get reverted between tests.
Moved the revertting code from the decommissioning job and into the JournalEntry model. Also added some tests to validate the code.
…llc/nautobot-plugin-design-builder into feature_delices_decom_job
nautobot_design_builder/models.py
Outdated
ValidationError: _description_ | ||
|
||
class JournalEntry(PrimaryModel): | ||
Returns: | ||
_type_: _description_ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess these would need to be fixed - I don't want to hold the MR up over this but before this gets into develop
we will need to work with it anyway
TODO
Journal
andDesignInstance