diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92f1bdba1..14642f4ca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,6 +25,8 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" + with: + poetry-version: "1.8.4" - name: "Linting: ruff format" run: "poetry run invoke ruff --action format" ruff-lint: @@ -36,6 +38,8 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" + with: + poetry-version: "1.8.4" - name: "Linting: ruff" run: "poetry run invoke ruff --action lint" check-docs-build: @@ -47,6 +51,8 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" + with: + poetry-version: "1.8.4" - name: "Check Docs Build" run: "poetry run invoke build-and-check-docs" poetry: @@ -58,6 +64,8 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" + with: + poetry-version: "1.8.4" - name: "Checking: poetry lock file" run: "poetry run invoke lock --check" yamllint: @@ -69,6 +77,8 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" + with: + poetry-version: "1.8.4" - name: "Linting: yamllint" run: "poetry run invoke yamllint" check-in-docker: @@ -91,6 +101,8 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" + with: + poetry-version: "1.8.4" - name: "Constrain Nautobot version and regenerate lock file" env: INVOKE_NAUTOBOT_SSOT_LOCAL: "true" @@ -146,6 +158,8 @@ jobs: uses: "actions/checkout@v4" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" + with: + poetry-version: "1.8.4" - name: "Constrain Nautobot version and regenerate lock file" env: INVOKE_NAUTOBOT_SSOT_LOCAL: "true" @@ -187,6 +201,8 @@ jobs: fetch-depth: "0" - name: "Setup environment" uses: "networktocode/gh-action-setup-poetry-environment@v6" + with: + poetry-version: "1.8.4" - name: "Check for changelog entry" run: | git fetch --no-tags origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.base_ref }} diff --git a/changes/641.fixed b/changes/641.fixed new file mode 100644 index 000000000..7f67f028b --- /dev/null +++ b/changes/641.fixed @@ -0,0 +1 @@ +Fixed incorrectly nested imports within if block used for Device Lifecycle Models. \ No newline at end of file diff --git a/nautobot_ssot/integrations/bootstrap/diffsync/models/bootstrap.py b/nautobot_ssot/integrations/bootstrap/diffsync/models/bootstrap.py index 86729e066..88edaa72a 100755 --- a/nautobot_ssot/integrations/bootstrap/diffsync/models/bootstrap.py +++ b/nautobot_ssot/integrations/bootstrap/diffsync/models/bootstrap.py @@ -402,148 +402,154 @@ def delete(self): return self -if LIFECYCLE_MGMT: +class BootstrapNamespace(Namespace): + """Bootstrap implementation of Bootstrap Namespace model.""" - class BootstrapSoftware(Software): - """Bootstrap implementation of Bootstrap Software model.""" + @classmethod + def create(cls, diffsync, ids, attrs): + """Create Namespace in Bootstrap from BootstrapNamespace object.""" + return super().create(diffsync=diffsync, ids=ids, attrs=attrs) - @classmethod - def create(cls, diffsync, ids, attrs): - """Create Software in Bootstrap from BootstrapSoftware object.""" - return super().create(diffsync=diffsync, ids=ids, attrs=attrs) + def update(self, attrs): + """Update Namespace in Bootstrap from BootstrapNamespace object.""" + return super().update(attrs) - def update(self, attrs): - """Update Software in Bootstrap from BootstrapSoftware object.""" - return super().update(attrs) + def delete(self): + """Delete Namespace in Bootstrap from BootstrapNamespace object.""" + return self - def delete(self): - """Delete Software in Bootstrap from BootstrapSoftware object.""" - return self - class BootstrapSoftwareImage(SoftwareImage): - """Bootstrap implementation of Bootstrap SoftwareImage model.""" +class BootstrapRiR(RiR): + """Bootstrap implementation of Bootstrap RiR model.""" - @classmethod - def create(cls, diffsync, ids, attrs): - """Create SoftwareImage in Bootstrap from BootstrapSoftwareImage object.""" - return super().create(diffsync=diffsync, ids=ids, attrs=attrs) + @classmethod + def create(cls, diffsync, ids, attrs): + """Create RiR in Bootstrap from BootstrapRiR object.""" + return super().create(diffsync=diffsync, ids=ids, attrs=attrs) - def update(self, attrs): - """Update SoftwareImage in Bootstrap from BootstrapSoftwareImage object.""" - return super().update(attrs) + def update(self, attrs): + """Update RiR in Bootstrap from BootstrapRiR object.""" + return super().update(attrs) - def delete(self): - """Delete SoftwareImage in Bootstrap from BootstrapSoftwareImage object.""" - return self + def delete(self): + """Delete RiR in Bootstrap from BootstrapRiR object.""" + return self - class BootstrapValidatedSoftware(ValidatedSoftware): - """Bootstrap implementation of Bootstrap ValidatedSoftware model.""" - @classmethod - def create(cls, diffsync, ids, attrs): - """Create ValidatedSoftware in Bootstrap from BootstrapValidatedSoftware object.""" - return super().create(diffsync=diffsync, ids=ids, attrs=attrs) +class BootstrapVLANGroup(VLANGroup): + """Bootstrap implementation of Bootstrap VLANGroup model.""" - def update(self, attrs): - """Update ValidatedSoftware in Bootstrap from BootstrapValidatedSoftware object.""" - return super().update(attrs) + @classmethod + def create(cls, diffsync, ids, attrs): + """Create VLANGroup in Bootstrap from BootstrapVLANGroup object.""" + return super().create(diffsync=diffsync, ids=ids, attrs=attrs) - def delete(self): - """Delete ValidatedSoftware in Bootstrap from BootstrapValidatedSoftware object.""" - return self + def update(self, attrs): + """Update VLANGroup in Bootstrap from BootstrapVLANGroup object.""" + return super().update(attrs) - class BootstrapNamespace(Namespace): - """Bootstrap implementation of Bootstrap Namespace model.""" + def delete(self): + """Delete VLANGroup in Bootstrap from BootstrapVLANGroup object.""" + return self - @classmethod - def create(cls, diffsync, ids, attrs): - """Create Namespace in Bootstrap from BootstrapNamespace object.""" - return super().create(diffsync=diffsync, ids=ids, attrs=attrs) - def update(self, attrs): - """Update Namespace in Bootstrap from BootstrapNamespace object.""" - return super().update(attrs) +class BootstrapVLAN(VLAN): + """Bootstrap implementation of Bootstrap VLAN model.""" - def delete(self): - """Delete Namespace in Bootstrap from BootstrapNamespace object.""" - return self + @classmethod + def create(cls, diffsync, ids, attrs): + """Create VLAN in Bootstrap from BootstrapVLAN object.""" + return super().create(diffsync=diffsync, ids=ids, attrs=attrs) - class BootstrapRiR(RiR): - """Bootstrap implementation of Bootstrap RiR model.""" + def update(self, attrs): + """Update VLAN in Bootstrap from BootstrapVLAN object.""" + return super().update(attrs) - @classmethod - def create(cls, diffsync, ids, attrs): - """Create RiR in Bootstrap from BootstrapRiR object.""" - return super().create(diffsync=diffsync, ids=ids, attrs=attrs) + def delete(self): + """Delete VLAN in Bootstrap from BootstrapVLAN object.""" + return self - def update(self, attrs): - """Update RiR in Bootstrap from BootstrapRiR object.""" - return super().update(attrs) - def delete(self): - """Delete RiR in Bootstrap from BootstrapRiR object.""" - return self +class BootstrapVRF(VRF): + """Bootstrap implementation of Bootstrap VRF model.""" - class BootstrapVLANGroup(VLANGroup): - """Bootstrap implementation of Bootstrap VLANGroup model.""" + @classmethod + def create(cls, diffsync, ids, attrs): + """Create VRF in Bootstrap from BootstrapVRF object.""" + return super().create(diffsync=diffsync, ids=ids, attrs=attrs) - @classmethod - def create(cls, diffsync, ids, attrs): - """Create VLANGroup in Bootstrap from BootstrapVLANGroup object.""" - return super().create(diffsync=diffsync, ids=ids, attrs=attrs) + def update(self, attrs): + """Update VRF in Bootstrap from BootstrapVRF object.""" + return super().update(attrs) - def update(self, attrs): - """Update VLANGroup in Bootstrap from BootstrapVLANGroup object.""" - return super().update(attrs) + def delete(self): + """Delete VRF in Bootstrap from BootstrapVRF object.""" + return self - def delete(self): - """Delete VLANGroup in Bootstrap from BootstrapVLANGroup object.""" - return self - class BootstrapVLAN(VLAN): - """Bootstrap implementation of Bootstrap VLAN model.""" +class BootstrapPrefix(Prefix): + """Bootstrap implementation of Bootstrap Prefix model.""" + + @classmethod + def create(cls, diffsync, ids, attrs): + """Create Prefix in Bootstrap from BootstrapPrefix object.""" + return super().create(diffsync=diffsync, ids=ids, attrs=attrs) + + def update(self, attrs): + """Update Prefix in Bootstrap from BootstrapPrefix object.""" + return super().update(attrs) + + def delete(self): + """Delete Prefix in Bootstrap from BootstrapPrefix object.""" + return self + + +if LIFECYCLE_MGMT: + + class BootstrapSoftware(Software): + """Bootstrap implementation of Bootstrap Software model.""" @classmethod def create(cls, diffsync, ids, attrs): - """Create VLAN in Bootstrap from BootstrapVLAN object.""" + """Create Software in Bootstrap from BootstrapSoftware object.""" return super().create(diffsync=diffsync, ids=ids, attrs=attrs) def update(self, attrs): - """Update VLAN in Bootstrap from BootstrapVLAN object.""" + """Update Software in Bootstrap from BootstrapSoftware object.""" return super().update(attrs) def delete(self): - """Delete VLAN in Bootstrap from BootstrapVLAN object.""" + """Delete Software in Bootstrap from BootstrapSoftware object.""" return self - class BootstrapVRF(VRF): - """Bootstrap implementation of Bootstrap VRF model.""" + class BootstrapSoftwareImage(SoftwareImage): + """Bootstrap implementation of Bootstrap SoftwareImage model.""" @classmethod def create(cls, diffsync, ids, attrs): - """Create VRF in Bootstrap from BootstrapVRF object.""" + """Create SoftwareImage in Bootstrap from BootstrapSoftwareImage object.""" return super().create(diffsync=diffsync, ids=ids, attrs=attrs) def update(self, attrs): - """Update VRF in Bootstrap from BootstrapVRF object.""" + """Update SoftwareImage in Bootstrap from BootstrapSoftwareImage object.""" return super().update(attrs) def delete(self): - """Delete VRF in Bootstrap from BootstrapVRF object.""" + """Delete SoftwareImage in Bootstrap from BootstrapSoftwareImage object.""" return self - class BootstrapPrefix(Prefix): - """Bootstrap implementation of Bootstrap Prefix model.""" + class BootstrapValidatedSoftware(ValidatedSoftware): + """Bootstrap implementation of Bootstrap ValidatedSoftware model.""" @classmethod def create(cls, diffsync, ids, attrs): - """Create Prefix in Bootstrap from BootstrapPrefix object.""" + """Create ValidatedSoftware in Bootstrap from BootstrapValidatedSoftware object.""" return super().create(diffsync=diffsync, ids=ids, attrs=attrs) def update(self, attrs): - """Update Prefix in Bootstrap from BootstrapPrefix object.""" + """Update ValidatedSoftware in Bootstrap from BootstrapValidatedSoftware object.""" return super().update(attrs) def delete(self): - """Delete Prefix in Bootstrap from BootstrapPrefix object.""" + """Delete ValidatedSoftware in Bootstrap from BootstrapValidatedSoftware object.""" return self diff --git a/nautobot_ssot/tests/infoblox/test_tags_and_cfs.py b/nautobot_ssot/tests/infoblox/test_tags_and_cfs.py index f4113c490..e5b91dda3 100644 --- a/nautobot_ssot/tests/infoblox/test_tags_and_cfs.py +++ b/nautobot_ssot/tests/infoblox/test_tags_and_cfs.py @@ -127,8 +127,7 @@ def test_objects_synced_to_infoblox_are_tagged(self): """Ensure objects synced to Infoblox have 'SSoT Synced to Infoblox' tag applied.""" create_prefix_relationship() nb_prefix = Prefix( - network="10.0.0.0", - prefix_length=8, + prefix="10.0.0.0/8", description="Test Network", type="network", status=Status.objects.get_for_model(Prefix).first(), @@ -204,8 +203,7 @@ def test_cfs_have_correct_content_types_set(self): def test_cf_updated_for_objects_synced_to_infoblox(self): """Ensure objects synced to Infoblox have cf 'ssot_synced_to_infoblox' correctly updated.""" nb_prefix = Prefix( - network="10.0.0.0", - prefix_length=8, + prefix="10.0.0.0/8", description="Test Network", type="network", status=Status.objects.get_for_model(Prefix).first(),