Skip to content

Commit

Permalink
Merge branch 'main' into add_restore_plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
rohitthakur2590 authored Apr 11, 2024
2 parents 7ed08d3 + 9eaa97e commit fb4100e
Show file tree
Hide file tree
Showing 12 changed files with 127 additions and 89 deletions.
67 changes: 67 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[flake8]

builtins = _

# Print the total number of errors:
count = true

# Don't even try to analyze these:
extend-exclude =
# No need to traverse egg info dir
*.egg-info,
# tool cache dirs
*_cache
# project env vars
.env,
# GitHub configs
.github,
# Cache files of MyPy
.mypy_cache,
# Cache files of pytest
.pytest_cache,
# Temp dir of pytest-testmon
.tmontmp,
# Occasional virtualenv dir
.venv
# VS Code
.vscode,
# Temporary build dir
build,
# This contains sdists and wheels of ansible-navigator that we don't want to check
dist,
# Metadata of `pip wheel` cmd is autogenerated
pip-wheel-metadata,
# adjacent venv
venv
# ansible won't let me
__init__.py

# IMPORTANT: avoid using ignore option, always use extend-ignore instead
# Completely and unconditionally ignore the following errors:
extend-ignore =
F841,
# line-length
E501,
# module level import not at top of file
E402

# Accessibility/large fonts and PEP8 unfriendly:
max-line-length = 120

# Allow certain violations in certain files:
# Please keep both sections of this list sorted, as it will be easier for others to find and add entries in the future
per-file-ignores =
# The following ignores have been researched and should be considered permanent
# each should be preceeded with an explanation of each of the error codes
# If other ignores are added for a specific file in the section following this,
# these will need to be added to that line as well.


# S101: Allow the use of assert within the tests directory, since tests require it.
tests/**.py: S101

# The following were present during the initial implementation.
# They are expected to be fixed and unignored over time.

# Count the number of occurrences of each error/warning code and print a report:
statistics = true
10 changes: 3 additions & 7 deletions .github/workflows/ack.yml → .github/workflows/check_label.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
---
# See https://github.com/ansible-community/devtools/blob/main/.github/workflows/ack.yml
name: ack

name: "Check label"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

on: # yamllint disable-line rule:truthy
pull_request_target:
types: [opened, labeled, unlabeled, synchronize]

jobs:
ack:
uses: ansible/devtools/.github/workflows/ack.yml@main
check_label:
uses: ansible/ansible-content-actions/.github/workflows/check_label.yaml@main
18 changes: 18 additions & 0 deletions .github/workflows/draft_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: "Draft release"
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on: # yamllint disable-line rule:truthy
workflow_dispatch:
env:
NAMESPACE: ${{ github.repository_owner }}
COLLECTION_NAME: junos
ANSIBLE_COLLECTIONS_PATHS: ./
jobs:
update_release_draft:
uses: ansible/ansible-content-actions/.github/workflows/draft_release.yaml@main
with:
repo: ${{ github.event.pull_request.head.repo.full_name }}
secrets:
BOT_PAT: ${{ secrets.BOT_PAT }}
13 changes: 0 additions & 13 deletions .github/workflows/lint.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/push.yml

This file was deleted.

19 changes: 13 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: CI
name: "CI"

concurrency:
group: ${{ github.head_ref || github.run_id }}
Expand All @@ -14,12 +14,16 @@ on: # yamllint disable-line rule:truthy

jobs:
changelog:
uses: ansible-network/github_actions/.github/workflows/changelog.yml@main
uses: ansible/ansible-content-actions/.github/workflows/changelog.yaml@main
if: github.event_name == 'pull_request'
build-import:
uses: ansible/ansible-content-actions/.github/workflows/build_import.yaml@main
ansible-lint:
uses: ansible/ansible-content-actions/.github/workflows/ansible_lint.yaml@main
sanity:
uses: ansible-network/github_actions/.github/workflows/sanity.yml@main
uses: ansible/ansible-content-actions/.github/workflows/sanity.yaml@main
unit-galaxy:
uses: ansible-network/github_actions/.github/workflows/unit_galaxy.yml@main
uses: ansible/ansible-content-actions/.github/workflows/unit.yaml@main
unit-source:
uses: ansible-network/github_actions/.github/workflows/unit_source.yml@main
with:
Expand All @@ -30,16 +34,19 @@ jobs:
if: ${{ always() && (github.event_name != 'schedule') }}
needs:
- changelog
- build-import
- sanity
- unit-galaxy
- unit-source
- ansible-lint
runs-on: ubuntu-latest
steps:
- run: >-
python -c "assert 'failure' not in
set([
'${{ needs.changelog.result }}',
'${{ needs.build-import.result }}',
'${{ needs.sanity.result }}',
'${{ needs.unit-galaxy.result }}',
'${{ needs.unit-galaxy.result }}'
'${{ needs.ansible-lint.result }}'
'${{ needs.unit-source.result }}'
])"
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,8 @@ repos:
rev: 23.12.1
hooks:
- id: black

- repo: https://github.com/pycqa/flake8
rev: 7.0.0
hooks:
- id: flake8
4 changes: 4 additions & 0 deletions changelogs/fragments/218sanity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
trivial:
- Add sanity ignore file for 2.18
- Change github actions workflow to content-actions
1 change: 1 addition & 0 deletions tests/sanity/ignore-2.18.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
plugins/action/junos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local`
10 changes: 6 additions & 4 deletions tests/unit/modules/network/junos/test_junos_ospfv2.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ def test_junos_ospfv2_overridden(self):
result = self.execute_module(changed=True, commands=commands)
self.assertEqual(sorted(result["commands"]), sorted(commands))

def test_junos_ospfv2_rendered(self):
def test_junos_ospfv2_deleted(self):
set_module_args(
dict(
config=[],
Expand All @@ -577,11 +577,13 @@ def test_junos_ospfv2_rendered(self):
)
commands = [
'<nc:protocols xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0"><nc:ospf>'
'<nc:area delete="delete">0.0.0.100</nc:area><nc:spf-options delete="delete"/>'
'<nc:reference-bandwidth delete="delete"/><nc:no-rfc-1583 delete="delete"/>'
'<nc:overload delete="delete"/></nc:ospf></nc:protocols>',
'<nc:area delete="delete">0.0.0.100</nc:area><nc:area delete="delete">0.0.0.200</nc:area>'
'<nc:spf-options delete="delete"/><nc:reference-bandwidth delete="delete"/>'
'<nc:no-rfc-1583 delete="delete"/><nc:overload delete="delete"/>'
'<nc:prefix-export-limit delete="delete"/></nc:ospf></nc:protocols>',
]
result = self.execute_module(changed=True, commands=commands)

self.assertEqual(sorted(result["commands"]), sorted(commands))

def test_junos_ospfv2_parsed(self):
Expand Down
10 changes: 10 additions & 0 deletions tox-ansible.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[ansible]

skip =
py3.7
py3.8
2.9
2.10
2.11
2.12
2.13
32 changes: 0 additions & 32 deletions tox.ini

This file was deleted.

0 comments on commit fb4100e

Please sign in to comment.