From 393873a18d9be37979c8b564ff2b3fe40399822d Mon Sep 17 00:00:00 2001 From: Josh VanDeraa Date: Wed, 26 Jun 2024 07:31:25 -0500 Subject: [PATCH 1/6] Fixes 771 Updates navigation. (#772) * Updates navigation. --- changes/771.documentation | 1 + mkdocs.yml | 2 ++ 2 files changed, 3 insertions(+) create mode 100644 changes/771.documentation diff --git a/changes/771.documentation b/changes/771.documentation new file mode 100644 index 00000000..ad7e37fe --- /dev/null +++ b/changes/771.documentation @@ -0,0 +1 @@ +Updated navigation tree for documentation updates for 2.1 release notes and XML compliance. \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index fca1c9dd..078b57dd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -110,6 +110,7 @@ nav: - Navigate Compliance: "user/app_feature_compliance.md" - Navigate Compliance CLI: "user/app_feature_compliancecli.md" - Navigate Compliance JSON: "user/app_feature_compliancejson.md" + - Navigate Compliance XML: "user/app_feature_compliancexml.md" - Navigate Compliance Custom: "user/app_feature_compliancecustom.md" - Navigate Intended: "user/app_feature_intended.md" - Navigate SoT Agg: "user/app_feature_sotagg.md" @@ -163,6 +164,7 @@ nav: - Migrating To v2: "admin/migrating_to_v2.md" - Release Notes: - "admin/release_notes/index.md" + - v2.1: "admin/release_notes/version_2.1.md" - v2.0: "admin/release_notes/version_2.0.md" - v1.6: "admin/release_notes/version_1.6.md" - v1.5: "admin/release_notes/version_1.5.md" From 3f5fe265a2a165db19c24c13cc3933ff36b3ee87 Mon Sep 17 00:00:00 2001 From: Leo Kirchner Date: Thu, 27 Jun 2024 21:13:51 +0200 Subject: [PATCH 2/6] allows version 7 of deepdiff (#773) As per https://github.com/seperman/deepdiff/issues/464 deepdiff 7 is compatible with numpy 2.0 whereas lower versions are not. --- changes/773.fixed | 1 + poetry.lock | 42 +++++++++++++++++++++++++++++++++--------- pyproject.toml | 2 +- 3 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 changes/773.fixed diff --git a/changes/773.fixed b/changes/773.fixed new file mode 100644 index 00000000..e8d14c9a --- /dev/null +++ b/changes/773.fixed @@ -0,0 +1 @@ +Fixed deepdiff dependency range \ No newline at end of file diff --git a/poetry.lock b/poetry.lock index 99b6fbe4..dde2aa75 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. [[package]] name = "amqp" @@ -880,20 +880,20 @@ files = [ [[package]] name = "deepdiff" -version = "6.5.0" +version = "7.0.1" description = "Deep Difference and Search of any Python object/data. Recreate objects by adding adding deltas to each other." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "deepdiff-6.5.0-py3-none-any.whl", hash = "sha256:acdc1651a3e802415e0337b7e1192df5cd7c17b72fbab480466fdd799b9a72e7"}, - {file = "deepdiff-6.5.0.tar.gz", hash = "sha256:080b1359d6128f3f5f1738c6be3064f0ad9b0cc41994aa90a028065f6ad11f25"}, + {file = "deepdiff-7.0.1-py3-none-any.whl", hash = "sha256:447760081918216aa4fd4ca78a4b6a848b81307b2ea94c810255334b759e1dc3"}, + {file = "deepdiff-7.0.1.tar.gz", hash = "sha256:260c16f052d4badbf60351b4f77e8390bee03a0b516246f6839bc813fb429ddf"}, ] [package.dependencies] -ordered-set = ">=4.0.2,<4.2.0" +ordered-set = ">=4.1.0,<4.2.0" [package.extras] -cli = ["click (==8.1.3)", "pyyaml (==6.0.1)"] +cli = ["click (==8.1.7)", "pyyaml (==6.0.1)"] optimize = ["orjson"] [[package]] @@ -2118,6 +2118,8 @@ files = [ {file = "lxml-4.9.3-cp27-cp27m-macosx_11_0_x86_64.whl", hash = "sha256:b0a545b46b526d418eb91754565ba5b63b1c0b12f9bd2f808c852d9b4b2f9b5c"}, {file = "lxml-4.9.3-cp27-cp27m-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:075b731ddd9e7f68ad24c635374211376aa05a281673ede86cbe1d1b3455279d"}, {file = "lxml-4.9.3-cp27-cp27m-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:1e224d5755dba2f4a9498e150c43792392ac9b5380aa1b845f98a1618c94eeef"}, + {file = "lxml-4.9.3-cp27-cp27m-win32.whl", hash = "sha256:2c74524e179f2ad6d2a4f7caf70e2d96639c0954c943ad601a9e146c76408ed7"}, + {file = "lxml-4.9.3-cp27-cp27m-win_amd64.whl", hash = "sha256:4f1026bc732b6a7f96369f7bfe1a4f2290fb34dce00d8644bc3036fb351a4ca1"}, {file = "lxml-4.9.3-cp27-cp27mu-manylinux_2_5_i686.manylinux1_i686.whl", hash = "sha256:c0781a98ff5e6586926293e59480b64ddd46282953203c76ae15dbbbf302e8bb"}, {file = "lxml-4.9.3-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl", hash = "sha256:cef2502e7e8a96fe5ad686d60b49e1ab03e438bd9123987994528febd569868e"}, {file = "lxml-4.9.3-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:b86164d2cff4d3aaa1f04a14685cbc072efd0b4f99ca5708b2ad1b9b5988a991"}, @@ -2297,6 +2299,16 @@ files = [ {file = "MarkupSafe-2.1.3-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:5bbe06f8eeafd38e5d0a4894ffec89378b6c6a625ff57e3028921f8ff59318ac"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win32.whl", hash = "sha256:dd15ff04ffd7e05ffcb7fe79f1b98041b8ea30ae9234aed2a9168b5797c3effb"}, {file = "MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl", hash = "sha256:134da1eca9ec0ae528110ccc9e48041e0828d79f24121a1a146161103c76e686"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:f698de3fd0c4e6972b92290a45bd9b1536bffe8c6759c62471efaa8acb4c37bc"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:aa57bd9cf8ae831a362185ee444e15a93ecb2e344c8e52e4d721ea3ab6ef1823"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ffcc3f7c66b5f5b7931a5aa68fc9cecc51e685ef90282f4a82f0f5e9b704ad11"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:47d4f1c5f80fc62fdd7777d0d40a2e9dda0a05883ab11374334f6c4de38adffd"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:1f67c7038d560d92149c060157d623c542173016c4babc0c1913cca0564b9939"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:9aad3c1755095ce347e26488214ef77e0485a3c34a50c5a5e2471dff60b9dd9c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:14ff806850827afd6b07a5f32bd917fb7f45b046ba40c57abdb636674a8b559c"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8f9293864fe09b8149f0cc42ce56e3f0e54de883a9de90cd427f191c346eb2e1"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win32.whl", hash = "sha256:715d3562f79d540f251b99ebd6d8baa547118974341db04f5ad06d5ea3eb8007"}, + {file = "MarkupSafe-2.1.3-cp312-cp312-win_amd64.whl", hash = "sha256:1b8dd8c3fd14349433c79fa8abeb573a55fc0fdd769133baac1f5e07abf54aeb"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:8e254ae696c88d98da6555f5ace2279cf7cd5b3f52be2b5cf97feafe883b58d2"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:cb0932dc158471523c9637e807d9bfb93e06a95cbf010f1a38b98623b929ef2b"}, {file = "MarkupSafe-2.1.3-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9402b03f1a1b4dc4c19845e5c749e3ab82d5078d16a2a4c2cd2df62d57bb0707"}, @@ -3703,6 +3715,7 @@ files = [ {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:69b023b2b4daa7548bcfbd4aa3da05b3a74b772db9e23b982788168117739938"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:81e0b275a9ecc9c0c0c07b4b90ba548307583c125f54d5b6946cfee6360c733d"}, {file = "PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ba336e390cd8e4d1739f42dfe9bb83a3cc2e80f567d8805e11b46f4a943f5515"}, + {file = "PyYAML-6.0.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:326c013efe8048858a6d312ddd31d56e468118ad4cdeda36c719bf5bb6192290"}, {file = "PyYAML-6.0.1-cp310-cp310-win32.whl", hash = "sha256:bd4af7373a854424dabd882decdc5579653d7868b8fb26dc7d0e99f823aa5924"}, {file = "PyYAML-6.0.1-cp310-cp310-win_amd64.whl", hash = "sha256:fd1592b3fdf65fff2ad0004b5e363300ef59ced41c2e6b3a99d4089fa8c5435d"}, {file = "PyYAML-6.0.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:6965a7bc3cf88e5a1c3bd2e0b5c22f8d677dc88a455344035f03399034eb3007"}, @@ -3710,8 +3723,16 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:42f8152b8dbc4fe7d96729ec2b99c7097d656dc1213a3229ca5383f973a5ed6d"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:062582fca9fabdd2c8b54a3ef1c978d786e0f6b3a1510e0ac93ef59e0ddae2bc"}, {file = "PyYAML-6.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d2b04aac4d386b172d5b9692e2d2da8de7bfb6c387fa4f801fbf6fb2e6ba4673"}, + {file = "PyYAML-6.0.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:e7d73685e87afe9f3b36c799222440d6cf362062f78be1013661b00c5c6f678b"}, {file = "PyYAML-6.0.1-cp311-cp311-win32.whl", hash = "sha256:1635fd110e8d85d55237ab316b5b011de701ea0f29d07611174a1b42f1444741"}, {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, + {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, + {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, + {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, + {file = "PyYAML-6.0.1-cp312-cp312-win_amd64.whl", hash = "sha256:0d3304d8c0adc42be59c5f8a4d9e3d7379e6955ad754aa9d6ab7a398b59dd1df"}, {file = "PyYAML-6.0.1-cp36-cp36m-macosx_10_9_x86_64.whl", hash = "sha256:50550eb667afee136e9a77d6dc71ae76a44df8b3e51e41b77f6de2932bfe0f47"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1fe35611261b29bd1de0070f0b2f47cb6ff71fa6595c077e42bd0c419fa27b98"}, {file = "PyYAML-6.0.1-cp36-cp36m-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:704219a11b772aea0d8ecd7058d0082713c3562b4e271b849ad7dc4a5c90c13c"}, @@ -3728,6 +3749,7 @@ files = [ {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a0cd17c15d3bb3fa06978b4e8958dcdc6e0174ccea823003a106c7d4d7899ac5"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:28c119d996beec18c05208a8bd78cbe4007878c6dd15091efb73a30e90539696"}, {file = "PyYAML-6.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:7e07cbde391ba96ab58e532ff4803f79c4129397514e1413a7dc761ccd755735"}, + {file = "PyYAML-6.0.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:49a183be227561de579b4a36efbb21b3eab9651dd81b1858589f796549873dd6"}, {file = "PyYAML-6.0.1-cp38-cp38-win32.whl", hash = "sha256:184c5108a2aca3c5b3d3bf9395d50893a7ab82a38004c8f61c258d4428e80206"}, {file = "PyYAML-6.0.1-cp38-cp38-win_amd64.whl", hash = "sha256:1e2722cc9fbb45d9b87631ac70924c11d3a401b2d7f410cc0e3bbf249f2dca62"}, {file = "PyYAML-6.0.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:9eb6caa9a297fc2c2fb8862bc5370d0303ddba53ba97e71f08023b6cd73d16a8"}, @@ -3735,6 +3757,7 @@ files = [ {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:5773183b6446b2c99bb77e77595dd486303b4faab2b086e7b17bc6bef28865f6"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b786eecbdf8499b9ca1d697215862083bd6d2a99965554781d0d8d1ad31e13a0"}, {file = "PyYAML-6.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bc1bf2925a1ecd43da378f4db9e4f799775d6367bdb94671027b73b393a7c42c"}, + {file = "PyYAML-6.0.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:04ac92ad1925b2cff1db0cfebffb6ffc43457495c9b3c39d3fcae417d7125dc5"}, {file = "PyYAML-6.0.1-cp39-cp39-win32.whl", hash = "sha256:faca3bdcf85b2fc05d06ff3fbc1f83e1391b3e724afa3feba7d13eeab355484c"}, {file = "PyYAML-6.0.1-cp39-cp39-win_amd64.whl", hash = "sha256:510c9deebc5c0225e8c96813043e62b680ba2f9c50a08d3724c7f28a747d1486"}, {file = "PyYAML-6.0.1.tar.gz", hash = "sha256:bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"}, @@ -4095,7 +4118,8 @@ files = [ {file = "ruamel.yaml.clib-0.2.7-cp310-cp310-win32.whl", hash = "sha256:763d65baa3b952479c4e972669f679fe490eee058d5aa85da483ebae2009d231"}, {file = "ruamel.yaml.clib-0.2.7-cp310-cp310-win_amd64.whl", hash = "sha256:d000f258cf42fec2b1bbf2863c61d7b8918d31ffee905da62dede869254d3b8a"}, {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:045e0626baf1c52e5527bd5db361bc83180faaba2ff586e763d3d5982a876a9e"}, - {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-macosx_12_6_arm64.whl", hash = "sha256:721bc4ba4525f53f6a611ec0967bdcee61b31df5a56801281027a3a6d1c2daf5"}, + {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-macosx_13_0_arm64.whl", hash = "sha256:1a6391a7cabb7641c32517539ca42cf84b87b667bad38b78d4d42dd23e957c81"}, + {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-manylinux2014_aarch64.whl", hash = "sha256:9c7617df90c1365638916b98cdd9be833d31d337dbcd722485597b43c4a215bf"}, {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl", hash = "sha256:41d0f1fa4c6830176eef5b276af04c89320ea616655d01327d5ce65e50575c94"}, {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-win32.whl", hash = "sha256:f6d3d39611ac2e4f62c3128a9eed45f19a6608670c5a2f4f07f24e8de3441d38"}, {file = "ruamel.yaml.clib-0.2.7-cp311-cp311-win_amd64.whl", hash = "sha256:da538167284de58a52109a9b89b8f6a53ff8437dd6dc26d33b57bf6699153122"}, @@ -4814,4 +4838,4 @@ all = [] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12" -content-hash = "a9d406dd1f28016eeacc45da186bd65e76c32852b09c98ff348fe4d880addf8f" +content-hash = "20172d3408f0d068d72749f472aa20eca0102ac1a872685d11e1e324413f233e" diff --git a/pyproject.toml b/pyproject.toml index 8f0071a0..e0425a66 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,7 +32,7 @@ include = [ [tool.poetry.dependencies] python = ">=3.8,<3.12" -deepdiff = ">=5.5.0,!=6.0,!=6.1,<7" +deepdiff = ">=5.5.0,!=6.0,!=6.1,<8" django-pivot = "1.8.1" # The signature changed to return a non-queryset, do not upgrade without ensuring it returns a queryset matplotlib = "^3.3.2" nautobot-plugin-nornir = "^2.0.0" From 84002009b0c60561758a105abb94bc13552b17bf Mon Sep 17 00:00:00 2001 From: Gary Snider <75227981+gsnider2195@users.noreply.github.com> Date: Wed, 3 Jul 2024 12:13:55 -0700 Subject: [PATCH 3/6] Updated django-pivot to ~1.9.0 (#779) --- changes/769.dependencies | 1 + changes/769.housekeeping | 1 + nautobot_golden_config/api/serializers.py | 3 +- nautobot_golden_config/jobs.py | 2 +- .../nornir_plays/config_compliance.py | 3 +- nautobot_golden_config/tests/test_views.py | 69 ++++++++++++++++++- poetry.lock | 11 ++- pyproject.toml | 2 +- 8 files changed, 80 insertions(+), 12 deletions(-) create mode 100644 changes/769.dependencies create mode 100644 changes/769.housekeeping diff --git a/changes/769.dependencies b/changes/769.dependencies new file mode 100644 index 00000000..449a1137 --- /dev/null +++ b/changes/769.dependencies @@ -0,0 +1 @@ +Updated django-pivot to ~1.9.0. diff --git a/changes/769.housekeeping b/changes/769.housekeeping new file mode 100644 index 00000000..624c7bfb --- /dev/null +++ b/changes/769.housekeeping @@ -0,0 +1 @@ +Added view tests for ConfigComplianceUIViewSet. diff --git a/nautobot_golden_config/api/serializers.py b/nautobot_golden_config/api/serializers.py index f3a1c103..6e3a8f3e 100644 --- a/nautobot_golden_config/api/serializers.py +++ b/nautobot_golden_config/api/serializers.py @@ -1,4 +1,5 @@ """REST API serializer capabilities for graphql app.""" + # pylint: disable=too-many-ancestors from rest_framework import serializers @@ -93,7 +94,7 @@ class ConfigToPushSerializer(DeviceSerializer): config = serializers.SerializerMethodField() - class Meta(DeviceSerializer): + class Meta(DeviceSerializer.Meta): """Extend the Device serializer with the configuration after postprocessing.""" fields = "__all__" diff --git a/nautobot_golden_config/jobs.py b/nautobot_golden_config/jobs.py index 034e0591..2a2335b7 100644 --- a/nautobot_golden_config/jobs.py +++ b/nautobot_golden_config/jobs.py @@ -453,7 +453,7 @@ def _generate_config_plan_from_feature(self): def _generate_config_plan_from_manual(self): """Generate config plans from manual.""" default_context = { - "request": self.request, + "request": self.request, # pylint: disable=no-member "user": self.user, } for device in self._device_qs: diff --git a/nautobot_golden_config/nornir_plays/config_compliance.py b/nautobot_golden_config/nornir_plays/config_compliance.py index 1a8f0edd..4f44bf76 100644 --- a/nautobot_golden_config/nornir_plays/config_compliance.py +++ b/nautobot_golden_config/nornir_plays/config_compliance.py @@ -112,8 +112,7 @@ def diff_files(backup_file, intended_file): with open(intended_file, encoding="utf-8") as file: intended = file.readlines() - for line in difflib.unified_diff(backup, intended, lineterm=""): - yield line + yield from difflib.unified_diff(backup, intended, lineterm="") @close_threaded_db_connections diff --git a/nautobot_golden_config/tests/test_views.py b/nautobot_golden_config/tests/test_views.py index b5debfb3..cf49e3f4 100644 --- a/nautobot_golden_config/tests/test_views.py +++ b/nautobot_golden_config/tests/test_views.py @@ -7,9 +7,10 @@ from django.contrib.auth import get_user_model from django.contrib.contenttypes.models import ContentType -from django.test import TestCase +from django.test import override_settings, RequestFactory, TestCase from django.urls import reverse +from nautobot.core.models.querysets import RestrictedQuerySet from nautobot.dcim.models import Device from nautobot.extras.models import Relationship, RelationshipAssociation, Status from nautobot.core.testing import ViewTestCases @@ -350,3 +351,69 @@ def setUpTestData(cls): @skip("TODO: 2.0 Figure out how to have pass.") def test_list_objects_with_constrained_permission(self): pass + + +@override_settings(EXEMPT_VIEW_PERMISSIONS=["*"]) +class ConfigComplianceUIViewSetTestCase( + ViewTestCases.BulkDeleteObjectsViewTestCase, + # ViewTestCases.ListObjectsViewTestCase, # generic list view tests won't work for this view since the queryset is pivoted +): + """Test ConfigComplianceUIViewSet views.""" + + model = models.ConfigCompliance + + @classmethod + def setUpTestData(cls): + create_device_data() + dev01 = Device.objects.get(name="Device 1") + dev02 = Device.objects.get(name="Device 2") + dev03 = Device.objects.get(name="Device 3") + dev04 = Device.objects.get(name="Device 4") + + for iterator_i in range(4): + feature_dev01 = create_feature_rule_json(dev01, feature=f"TestFeature{iterator_i}") + feature_dev02 = create_feature_rule_json(dev02, feature=f"TestFeature{iterator_i}") + feature_dev03 = create_feature_rule_json(dev03, feature=f"TestFeature{iterator_i}") + + updates = [ + {"device": dev01, "feature": feature_dev01}, + {"device": dev02, "feature": feature_dev02}, + {"device": dev03, "feature": feature_dev03}, + {"device": dev04, "feature": feature_dev01}, + ] + for iterator_j, update in enumerate(updates): + compliance_int = iterator_j % 2 + models.ConfigCompliance.objects.create( + device=update["device"], + rule=update["feature"], + actual={"foo": {"bar-1": "baz"}}, + intended={"foo": {f"bar-{compliance_int}": "baz"}}, + compliance=bool(compliance_int), + compliance_int=compliance_int, + ) + + def test_alter_queryset(self): + """Test alter_queryset method returns the expected pivoted queryset.""" + + unused_features = ( + models.ComplianceFeature.objects.create(slug="unused-feature-1", name="Unused Feature 1"), + models.ComplianceFeature.objects.create(slug="unused-feature-2", name="Unused Feature 2"), + ) + request = RequestFactory(SERVER_NAME="nautobot.example.com").get( + reverse("plugins:nautobot_golden_config:configcompliance_list") + ) + request.user = self.user + queryset = views.ConfigComplianceUIViewSet(request=request).alter_queryset(request) + features = ( + models.ComplianceFeature.objects.filter(feature__rule__isnull=False) + .values_list("slug", flat=True) + .distinct() + ) + self.assertNotIn(unused_features[0].slug, features) + self.assertNotIn(unused_features[1].slug, features) + self.assertGreater(len(features), 0) + self.assertIsInstance(queryset, RestrictedQuerySet) + for device in queryset: + self.assertSequenceEqual(list(device.keys()), ["device", "device__name", *features]) + for feature in features: + self.assertIn(device[feature], [0, 1]) diff --git a/poetry.lock b/poetry.lock index dde2aa75..616bc924 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1126,18 +1126,17 @@ tests = ["tox"] [[package]] name = "django-pivot" -version = "1.8.1" +version = "1.9.0" description = "Create pivot tables and histograms from ORM querysets" optional = false python-versions = "*" files = [ - {file = "django-pivot-1.8.1.tar.gz", hash = "sha256:7184d3e3f5e96003150428bea106a9963f49f0431fa56f93595316c9b42bcca6"}, - {file = "django_pivot-1.8.1-py3-none-any.whl", hash = "sha256:9bf83b2b61d4dc95c01e5b7a595ee223c5c1f08a4590733673a306b1513174d4"}, + {file = "django-pivot-1.9.0.tar.gz", hash = "sha256:5e985d32d9ff2a6b89419dd0292c0fa2822d494ee479b5fd16cdb542abf66a88"}, + {file = "django_pivot-1.9.0-py3-none-any.whl", hash = "sha256:1c60e18e7d5f7e42856faee0961748082ddd05b01ae7c8a4baed64d2bbacd051"}, ] [package.dependencies] -django = ">=1.10" -six = "*" +django = ">=2.2.0" [[package]] name = "django-prometheus" @@ -4838,4 +4837,4 @@ all = [] [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.12" -content-hash = "20172d3408f0d068d72749f472aa20eca0102ac1a872685d11e1e324413f233e" +content-hash = "3320a0e8fced27e6dac2b0239c9067d73b8e91fe394da3c482543b5beb8ebade" diff --git a/pyproject.toml b/pyproject.toml index e0425a66..c31050d9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,7 +33,7 @@ include = [ [tool.poetry.dependencies] python = ">=3.8,<3.12" deepdiff = ">=5.5.0,!=6.0,!=6.1,<8" -django-pivot = "1.8.1" # The signature changed to return a non-queryset, do not upgrade without ensuring it returns a queryset +django-pivot = ">=1.9.0,<1.10.0" # The signature changed to return a non-queryset, do not upgrade without ensuring it returns a queryset matplotlib = "^3.3.2" nautobot-plugin-nornir = "^2.0.0" From 0cd3c4d5318efd9e2edf3f3f8d76cf90e8757cd7 Mon Sep 17 00:00:00 2001 From: Josh VanDeraa Date: Thu, 4 Jul 2024 11:23:56 -0500 Subject: [PATCH 4/6] Update app settings for docs (#777) * Set up docs link page.. --- changes/776.documentation | 1 + nautobot_golden_config/__init__.py | 1 + nautobot_golden_config/urls.py | 3 +++ 3 files changed, 5 insertions(+) create mode 100644 changes/776.documentation diff --git a/changes/776.documentation b/changes/776.documentation new file mode 100644 index 00000000..dd310001 --- /dev/null +++ b/changes/776.documentation @@ -0,0 +1 @@ +Updated app config and urls config for providing link to documentation. \ No newline at end of file diff --git a/nautobot_golden_config/__init__.py b/nautobot_golden_config/__init__.py index 0f6d1d2b..537cf109 100644 --- a/nautobot_golden_config/__init__.py +++ b/nautobot_golden_config/__init__.py @@ -19,6 +19,7 @@ class GoldenConfig(NautobotAppConfig): author_email = "opensource@networktocode.com" description = "Nautobot Apps that embraces NetDevOps and automates configuration backups, performs configuration compliance, generates intended configurations, and has config remediation and deployment features. Includes native Git integration and gives users the flexibility to mix and match the supported features." base_url = "golden-config" + docs_view_name = "plugins:nautobot_golden_config:docs" default_settings = { "enable_backup": True, "enable_compliance": True, diff --git a/nautobot_golden_config/urls.py b/nautobot_golden_config/urls.py index 24e238b7..ee2043d3 100644 --- a/nautobot_golden_config/urls.py +++ b/nautobot_golden_config/urls.py @@ -1,5 +1,7 @@ """Django urlpatterns declaration for config compliance app.""" from django.urls import path +from django.templatetags.static import static +from django.views.generic import RedirectView from nautobot.core.views.routers import NautobotUIViewSetRouter from nautobot_golden_config import views @@ -20,4 +22,5 @@ urlpatterns = [ path("config-compliance/overview/", views.ConfigComplianceOverview.as_view(), name="configcompliance_overview"), path("config-plan/bulk_deploy/", views.ConfigPlanBulkDeploy.as_view(), name="configplan_bulk-deploy"), + path("docs/", RedirectView.as_view(url=static("nautobot_golden_config/docs/index.html")), name="docs"), ] + router.urls From 5451c7d856399153a84c480357460110b964462a Mon Sep 17 00:00:00 2001 From: Ken Celenza Date: Thu, 4 Jul 2024 12:24:22 -0400 Subject: [PATCH 5/6] Add FAQ for deepdiff and numpy dependency issue. (#775) --- changes/775.documentation | 1 + docs/user/faq.md | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 changes/775.documentation diff --git a/changes/775.documentation b/changes/775.documentation new file mode 100644 index 00000000..df9a283e --- /dev/null +++ b/changes/775.documentation @@ -0,0 +1 @@ +Add FAQ for deepdiff and numpy dependency issue. \ No newline at end of file diff --git a/docs/user/faq.md b/docs/user/faq.md index 5ac4eef0..4594ba62 100644 --- a/docs/user/faq.md +++ b/docs/user/faq.md @@ -153,4 +153,8 @@ There is an ongoing effort to better document each [troubleshooting case](../adm ## _Why is the `_isnull` on DateTime filters considered experimental?_ -There are various ways we can create a programmatic interface, which may change the behavior or name, for now it should be considered experimental as we may update this strategy. \ No newline at end of file +There are various ways we can create a programmatic interface, which may change the behavior or name, for now it should be considered experimental as we may update this strategy. + +## _I received an error `AttributeError: `np.float_` was removed in the NumPy 2.0 release. Use `np.float64` instead.` what should I do?_ + +Due to an incompatiblitly between DeepDiff and numPy, you must find a version of those two that are compatible with each other. See [here](https://github.com/seperman/deepdiff/issues/464) for more information. The easiest thing to do is upgrade them both. From c016b4d6cada0c317fb587fb48f3179c53e963d5 Mon Sep 17 00:00:00 2001 From: Ken Celenza Date: Tue, 16 Jul 2024 16:49:39 -0400 Subject: [PATCH 6/6] Prep 2.1.1 (#782) --- .github/workflows/ci.yml | 4 ++-- changes/769.dependencies | 1 - changes/769.housekeeping | 1 - changes/771.documentation | 1 - changes/773.fixed | 1 - changes/775.documentation | 1 - changes/776.documentation | 1 - docs/admin/release_notes/version_2.1.md | 21 +++++++++++++++++++++ pyproject.toml | 2 +- 9 files changed, 24 insertions(+), 9 deletions(-) delete mode 100644 changes/769.dependencies delete mode 100644 changes/769.housekeeping delete mode 100644 changes/771.documentation delete mode 100644 changes/773.fixed delete mode 100644 changes/775.documentation delete mode 100644 changes/776.documentation diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f3c9bec..a02a72ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -191,9 +191,9 @@ jobs: - name: "Run Tests" run: "poetry run invoke unittest" changelog: - if: | + if: > contains(fromJson('["develop","ltm-1.6"]'), github.base_ref) && - (github.head_ref != 'main') + (github.head_ref != 'main') && (!startsWith(github.head_ref, 'release')) runs-on: "ubuntu-22.04" steps: - name: "Check out repository code" diff --git a/changes/769.dependencies b/changes/769.dependencies deleted file mode 100644 index 449a1137..00000000 --- a/changes/769.dependencies +++ /dev/null @@ -1 +0,0 @@ -Updated django-pivot to ~1.9.0. diff --git a/changes/769.housekeeping b/changes/769.housekeeping deleted file mode 100644 index 624c7bfb..00000000 --- a/changes/769.housekeeping +++ /dev/null @@ -1 +0,0 @@ -Added view tests for ConfigComplianceUIViewSet. diff --git a/changes/771.documentation b/changes/771.documentation deleted file mode 100644 index ad7e37fe..00000000 --- a/changes/771.documentation +++ /dev/null @@ -1 +0,0 @@ -Updated navigation tree for documentation updates for 2.1 release notes and XML compliance. \ No newline at end of file diff --git a/changes/773.fixed b/changes/773.fixed deleted file mode 100644 index e8d14c9a..00000000 --- a/changes/773.fixed +++ /dev/null @@ -1 +0,0 @@ -Fixed deepdiff dependency range \ No newline at end of file diff --git a/changes/775.documentation b/changes/775.documentation deleted file mode 100644 index df9a283e..00000000 --- a/changes/775.documentation +++ /dev/null @@ -1 +0,0 @@ -Add FAQ for deepdiff and numpy dependency issue. \ No newline at end of file diff --git a/changes/776.documentation b/changes/776.documentation deleted file mode 100644 index dd310001..00000000 --- a/changes/776.documentation +++ /dev/null @@ -1 +0,0 @@ -Updated app config and urls config for providing link to documentation. \ No newline at end of file diff --git a/docs/admin/release_notes/version_2.1.md b/docs/admin/release_notes/version_2.1.md index a2ac2dd4..6861806d 100644 --- a/docs/admin/release_notes/version_2.1.md +++ b/docs/admin/release_notes/version_2.1.md @@ -12,3 +12,24 @@ ### Fixed - [#723](https://github.com/nautobot/nautobot-app-golden-config/issues/723) - Hide compliance tab in device view if no compliance results exist. + + +## v2.1.1 + +### Fixed + +- [#773](https://github.com/nautobot/nautobot-app-golden-config/issues/773) - Fixed deepdiff dependency range. + +### Dependencies + +- [#769](https://github.com/nautobot/nautobot-app-golden-config/issues/769) - Updated django-pivot to ~1.9.0. + +### Documentation + +- [#771](https://github.com/nautobot/nautobot-app-golden-config/issues/771) - Updated navigation tree for documentation updates for 2.1 release notes and XML compliance. +- [#775](https://github.com/nautobot/nautobot-app-golden-config/issues/775) - Add FAQ for deepdiff and numpy dependency issue. +- [#776](https://github.com/nautobot/nautobot-app-golden-config/issues/776) - Updated app config and urls config for providing link to documentation. + +### Housekeeping + +- [#769](https://github.com/nautobot/nautobot-app-golden-config/issues/769) - Added view tests for ConfigComplianceUIViewSet. diff --git a/pyproject.toml b/pyproject.toml index c31050d9..52410407 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "nautobot-golden-config" -version = "2.1.0" +version = "2.1.1" description = "An app for configuration on nautobot" authors = ["Network to Code, LLC "] license = "Apache-2.0"