Skip to content

Commit

Permalink
Merge pull request #101 from scrapli/develop
Browse files Browse the repository at this point in the history
Prepare 2022.01.30 Release
  • Loading branch information
carlmontanari authored Jan 29, 2022
2 parents 186eb51 + 49663e3 commit 3ec22ed
Show file tree
Hide file tree
Showing 18 changed files with 98 additions and 83 deletions.
6 changes: 2 additions & 4 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@ updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
interval: "monthly"
timezone: "PST8PDT"
time: "03:00"
target-branch: "develop"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "sunday"
interval: "monthly"
timezone: "PST8PDT"
time: "03:00"
target-branch: "develop"
31 changes: 21 additions & 10 deletions .github/workflows/commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
max-parallel: 1
matrix:
os: [ubuntu-latest]
version: [3.9]
version: ["3.10"]
steps:
- uses: actions/checkout@v2
- name: set up python ${{ matrix.version }}
Expand All @@ -27,10 +27,10 @@ jobs:
build_posix:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 12
max-parallel: 8
matrix:
os: [ubuntu-latest, macos-latest]
version: [3.6, 3.7, 3.8, 3.9, 3.10.0-beta.4]
version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: set up python ${{ matrix.version }}
Expand All @@ -42,11 +42,11 @@ jobs:
# version we are targeting with nox, while still having versions like 3.9.0a4
run: |
echo "FRIENDLY_PYTHON_VERSION=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")" >> $GITHUB_ENV
- name: install libxml2 and libxslt seems to only be needed for 3.9+ image for some reason
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.9' || matrix.os == 'ubuntu-latest' && matrix.version == '3.10.0-beta.4'
- name: ensure openssl installed for macos
# openssl missing/being linked incorrectly causes ssh2-python install failures
if: matrix.os == 'macos-latest'
run: |
sudo apt install libxml2-dev
sudo apt install libxslt-dev
brew install openssl
- name: setup test env
run: |
python -m pip install --upgrade pip
Expand All @@ -63,7 +63,18 @@ jobs:
steps:
- uses: actions/checkout@v2
- run: docker run -v $(pwd):/docs --entrypoint "" squidfunk/mkdocs-material:latest ash -c 'pip install mdx_gh_links && mkdocs build --clean --strict'
- name: Cache htmltest external links
uses: actions/cache@v2
with:
path: tmp/.htmltest
# key will contain hash of all md files to check if files have changed
# when files are changed, a new key name is formed, and thus a new cache will be saved
key: htmltest-${{ hashFiles('docs/**/*.md') }}
# the restore key will fetch any previously saved cache even if there is no match on key
# this allows to use cache from prev runs and update it
restore-keys: |
htmltest-
- name: htmltest
run: |
curl https://htmltest.wjdp.uk | bash
./bin/htmltest -c docs/htmltest.yml
uses: wjdp/[email protected]
with:
config: docs/htmltest.yml
6 changes: 3 additions & 3 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up python 3.9
- name: set up python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.9
python-version: "3.10"
- name: setup publish env
run: |
python -m pip install --upgrade pip
Expand All @@ -27,7 +27,7 @@ jobs:
python setup.py sdist bdist_wheel
python -m twine upload dist/*
- name: create release branch
uses: peterjgrainger/action-create-branch@v2.0.1
uses: peterjgrainger/action-create-branch@v2.1.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/weekly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
max-parallel: 1
matrix:
os: [ubuntu-latest]
version: [3.9]
version: ["3.10"]
steps:
- uses: actions/checkout@v2
- name: set up python ${{ matrix.version }}
Expand All @@ -31,10 +31,10 @@ jobs:
build_posix:
runs-on: ${{ matrix.os }}
strategy:
max-parallel: 12
max-parallel: 8
matrix:
os: [ubuntu-latest, macos-latest]
version: [3.6, 3.7, 3.8, 3.9, 3.10.0-beta.4]
version: ["3.7", "3.8", "3.9", "3.10"]
steps:
- uses: actions/checkout@v2
- name: set up python ${{ matrix.version }}
Expand All @@ -46,11 +46,11 @@ jobs:
# version we are targeting with nox, while still having versions like 3.9.0a4
run: |
echo "FRIENDLY_PYTHON_VERSION=$(python -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')")" >> $GITHUB_ENV
- name: install libxml2 and libxslt seems to only be needed for 3.9+ image for some reason
if: matrix.os == 'ubuntu-latest' && matrix.version == '3.9' || matrix.os == 'ubuntu-latest' && matrix.version == '3.10.0-beta.4'
- name: ensure openssl installed for macos
# openssl missing/being linked incorrectly causes ssh2-python install failures
if: matrix.os == 'macos-latest'
run: |
sudo apt install libxml2-dev
sudo apt install libxslt-dev
brew install openssl
- name: setup test env
run: |
python -m pip install --upgrade pip
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ nornir_scrapli -- scrapli's plugin for nornir

## Requirements

MacOS or \*nix<sup>1</sup>, Python 3.6+
MacOS or \*nix<sup>1</sup>, Python 3.7+

<sup>1</sup> Although many parts of scrapli *do* run on Windows, Windows is not officially supported

Expand Down
12 changes: 6 additions & 6 deletions docs/api_docs/connection.md
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ Raises:


##### close
`close(self) ‑> NoneType`
`close(self) ‑> None`

```text
Override close method of normal nornir connection so we never close things
Expand All @@ -541,7 +541,7 @@ Raises:


##### open
`open(self, *args: Any, **kwargs: Any) ‑> NoneType`
`open(self, *args: Any, **kwargs: Any) ‑> None`

```text
Override open method of normal nornir connection so we can coopt an existing conn
Expand Down Expand Up @@ -671,7 +671,7 @@ class ScrapliCore:


##### close
`close(self) ‑> NoneType`
`close(self) ‑> None`

```text
Close a scrapli connection to a device
Expand All @@ -691,7 +691,7 @@ Raises:


##### open
`open(self, hostname: Optional[str], username: Optional[str], password: Optional[str], port: Optional[int], platform: Optional[str], extras: Optional[Dict[str, Any]] = None, configuration: Optional[nornir.core.configuration.Config] = None) ‑> NoneType`
`open(self, hostname: Optional[str], username: Optional[str], password: Optional[str], port: Optional[int], platform: Optional[str], extras: Optional[Dict[str, Any]] = None, configuration: Optional[nornir.core.configuration.Config] = None) ‑> None`

```text
Open a scrapli connection to a device
Expand Down Expand Up @@ -813,7 +813,7 @@ class ScrapliNetconf:


##### close
`close(self) ‑> NoneType`
`close(self) ‑> None`

```text
Close a scrapli netconf connection to a device
Expand All @@ -833,7 +833,7 @@ Raises:


##### open
`open(self, hostname: Optional[str], username: Optional[str], password: Optional[str], port: Optional[int], platform: Optional[str], extras: Optional[Dict[str, Any]] = None, configuration: Optional[nornir.core.configuration.Config] = None) ‑> NoneType`
`open(self, hostname: Optional[str], username: Optional[str], password: Optional[str], port: Optional[int], platform: Optional[str], extras: Optional[Dict[str, Any]] = None, configuration: Optional[nornir.core.configuration.Config] = None) ‑> None`

```text
Open a scrapli connection to a device
Expand Down
2 changes: 1 addition & 1 deletion docs/api_docs/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ __all__ = ("print_structured_result",)


#### print_structured_result
`print_structured_result(result: nornir.core.task.AggregatedResult, failed: bool = False, severity_level: int = 20, parser: str = 'textfsm', to_dict: bool = True, fail_to_string: bool = False) ‑> NoneType`
`print_structured_result(result: nornir.core.task.AggregatedResult, failed: bool = False, severity_level: int = 20, parser: str = 'textfsm', to_dict: bool = True, fail_to_string: bool = False) ‑> None`

```text
Prints the :obj:`nornir.core.task.Result` from a previous task to screen
Expand Down
18 changes: 9 additions & 9 deletions docs/api_docs/tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,15 @@ Raises:


#### netconf_get_config
`netconf_get_config(task: nornir.core.task.Task, source: str = 'running', filters: Union[str, List[str], NoneType] = None, filter_type: str = 'subtree') ‑> nornir.core.task.Result`
`netconf_get_config(task: nornir.core.task.Task, source: str = 'running', filter_: Union[str, List[str], ForwardRef(None)] = None, filter_type: str = 'subtree') ‑> nornir.core.task.Result`

```text
Get config from the device with scrapli_netconf
Args:
task: nornir task object
source: configuration source to get; typically one of running|startup|candidate
filters: string or list of strings of filters to apply to configuration
filter_: string of filter(s) to apply to configuration
filter_type: type of filter; subtree|xpath
Returns:
Expand Down Expand Up @@ -517,7 +517,7 @@ Raises:


#### send_command
`send_command(task: nornir.core.task.Task, command: str, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], NoneType] = None, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`
`send_command(task: nornir.core.task.Task, command: str, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], ForwardRef(None)] = None, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`

```text
Send a single command to device using scrapli
Expand Down Expand Up @@ -546,7 +546,7 @@ Raises:


#### send_commands
`send_commands(task: nornir.core.task.Task, commands: List[str], strip_prompt: bool = True, failed_when_contains: Union[str, List[str], NoneType] = None, stop_on_failed: bool = False, eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`
`send_commands(task: nornir.core.task.Task, commands: List[str], strip_prompt: bool = True, failed_when_contains: Union[str, List[str], ForwardRef(None)] = None, stop_on_failed: bool = False, eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`

```text
Send a list of commands to device using scrapli
Expand Down Expand Up @@ -580,7 +580,7 @@ Raises:


#### send_commands_from_file
`send_commands_from_file(task: nornir.core.task.Task, file: str, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], NoneType] = None, stop_on_failed: bool = False, eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`
`send_commands_from_file(task: nornir.core.task.Task, file: str, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], ForwardRef(None)] = None, stop_on_failed: bool = False, eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`

```text
Send a list of commands from a file to device using scrapli
Expand Down Expand Up @@ -613,7 +613,7 @@ Raises:


#### send_config
`send_config(task: nornir.core.task.Task, config: str, dry_run: Optional[bool] = None, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], NoneType] = None, stop_on_failed: bool = False, privilege_level: str = '', eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`
`send_config(task: nornir.core.task.Task, config: str, dry_run: Optional[bool] = None, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], ForwardRef(None)] = None, stop_on_failed: bool = False, privilege_level: str = '', eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`

```text
Send a config to device using scrapli
Expand Down Expand Up @@ -656,7 +656,7 @@ Raises:


#### send_configs
`send_configs(task: nornir.core.task.Task, configs: List[str], dry_run: Optional[bool] = None, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], NoneType] = None, stop_on_failed: bool = False, privilege_level: str = '', eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`
`send_configs(task: nornir.core.task.Task, configs: List[str], dry_run: Optional[bool] = None, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], ForwardRef(None)] = None, stop_on_failed: bool = False, privilege_level: str = '', eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`

```text
Send configs to device using scrapli
Expand Down Expand Up @@ -699,7 +699,7 @@ Raises:


#### send_configs_from_file
`send_configs_from_file(task: nornir.core.task.Task, file: str, dry_run: Optional[bool] = None, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], NoneType] = None, stop_on_failed: bool = False, privilege_level: str = '', eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`
`send_configs_from_file(task: nornir.core.task.Task, file: str, dry_run: Optional[bool] = None, strip_prompt: bool = True, failed_when_contains: Union[str, List[str], ForwardRef(None)] = None, stop_on_failed: bool = False, privilege_level: str = '', eager: bool = False, timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`

```text
Send configs from a file to device using scrapli
Expand Down Expand Up @@ -742,7 +742,7 @@ Raises:


#### send_interactive
`send_interactive(task: nornir.core.task.Task, interact_events: List[Tuple[str, str, Optional[bool]]], failed_when_contains: Union[str, List[str], NoneType] = None, privilege_level: str = '', timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`
`send_interactive(task: nornir.core.task.Task, interact_events: List[Tuple[str, str, Optional[bool]]], failed_when_contains: Union[str, List[str], ForwardRef(None)] = None, privilege_level: str = '', timeout_ops: Optional[float] = None) ‑> nornir.core.task.Result`

```text
Send inputs in an interactive fashion using scrapli; usually used to handle prompts
Expand Down
6 changes: 6 additions & 0 deletions docs/htmltest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ IgnoreSSLVerify: true
IgnoreDirs:
- overrides
IgnoreInternalEmptyHash: true
ExternalTimeout: 60
HTTPHeaders:
"Range": "bytes=0-10"
"Accept": "*/*"
CacheExpires: "96h"
HTTPConcurrencyLimit: 1
6 changes: 3 additions & 3 deletions nornir_scrapli/tasks/netconf/get_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
def netconf_get_config(
task: Task,
source: str = "running",
filters: Optional[Union[str, List[str]]] = None,
filter_: Optional[Union[str, List[str]]] = None,
filter_type: str = "subtree",
) -> Result:
"""
Expand All @@ -17,7 +17,7 @@ def netconf_get_config(
Args:
task: nornir task object
source: configuration source to get; typically one of running|startup|candidate
filters: string or list of strings of filters to apply to configuration
filter_: string of filter(s) to apply to configuration
filter_type: type of filter; subtree|xpath
Returns:
Expand All @@ -30,7 +30,7 @@ def netconf_get_config(
"""
scrapli_conn = task.host.get_connection("scrapli_netconf", task.nornir.config)
scrapli_response = scrapli_conn.get_config(
source=source, filters=filters, filter_type=filter_type
source=source, filter_=filter_, filter_type=filter_type
)

result = ScrapliResult(
Expand Down
Loading

0 comments on commit 3ec22ed

Please sign in to comment.