Skip to content

Commit

Permalink
bump version, fix publish workflow, slacken dev/doc pins, regen docs
Browse files Browse the repository at this point in the history
  • Loading branch information
carlmontanari committed Jan 29, 2022
1 parent 4ab3e4b commit db30c5f
Show file tree
Hide file tree
Showing 28 changed files with 425 additions and 302 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: set up python 3.10
uses: actions/setup-python@v2
with:
python-version: 3.10
python-version: "3.10"
- name: setup publish env
run: |
python -m pip install --upgrade pip
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ scrapli behaviour you know and love.

## Requirements

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

scrapli_cfg's only requirements is `scrapli`.

Expand All @@ -59,8 +59,8 @@ from scrapli_cfg import ScrapliCfg

device = {
"host": "172.18.0.11",
"auth_username": "vrnetlab",
"auth_password": "VR-netlab9",
"auth_username": "scrapli",
"auth_password": "scrapli",
"auth_strict_key": False,
"platform": "cisco_iosxe"
}
Expand Down
66 changes: 65 additions & 1 deletion docs/api_docs/diff.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,38 @@ class ScrapliCfgDiffResponse(ScrapliCfgResponse):
self._unified_diff = ""
self._side_by_side_diff = ""

def __repr__(self) -> str:
"""
Magic repr method for ScrapliCfgResponse class

Args:
N/A

Returns:
str: repr for class object

Raises:
N/A

"""
return f"ScrapliCfgDiffResponse <Success: {str(not self.failed)}>"

def __str__(self) -> str:
"""
Magic str method for ScrapliCfgDiffResponse class

Args:
N/A

Returns:
str: str for class object

Raises:
N/A

"""
return f"ScrapliCfgDiffResponse <Success: {str(not self.failed)}>"

def record_diff_response(
self, source_config: str, candidate_config: str, device_diff: str
) -> None:
Expand Down Expand Up @@ -290,6 +322,38 @@ class ScrapliCfgDiffResponse(ScrapliCfgResponse):
self._unified_diff = ""
self._side_by_side_diff = ""

def __repr__(self) -> str:
"""
Magic repr method for ScrapliCfgResponse class

Args:
N/A

Returns:
str: repr for class object

Raises:
N/A

"""
return f"ScrapliCfgDiffResponse <Success: {str(not self.failed)}>"

def __str__(self) -> str:
"""
Magic str method for ScrapliCfgDiffResponse class

Args:
N/A

Returns:
str: str for class object

Raises:
N/A

"""
return f"ScrapliCfgDiffResponse <Success: {str(not self.failed)}>"

def record_diff_response(
self, source_config: str, candidate_config: str, device_diff: str
) -> None:
Expand Down Expand Up @@ -476,7 +540,7 @@ Raises:


##### record_diff_response
`record_diff_response(self, source_config: str, candidate_config: str, device_diff: str) ‑> NoneType`
`record_diff_response(self, source_config: str, candidate_config: str, device_diff: str) ‑> None`

```text
Scrapli config diff object
Expand Down
2 changes: 1 addition & 1 deletion docs/api_docs/logging.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ logger.addHandler(NullHandler())


#### enable_basic_logging
`enable_basic_logging(file: Union[str, bool] = False, level: str = 'info', caller_info: bool = False, buffer_log: bool = True) ‑> NoneType`
`enable_basic_logging(file: Union[str, bool] = False, level: str = 'info', caller_info: bool = False, buffer_log: bool = True) ‑> None`

```text
Enable opinionated logging for scrapli_cfg
Expand Down
4 changes: 2 additions & 2 deletions docs/api_docs/platform/base/async_platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ Raises:


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

```text
Cleanup after scrapli-cfg operations
Expand Down Expand Up @@ -935,7 +935,7 @@ Raises:


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

```text
Prepare connection for scrapli_cfg operations
Expand Down
49 changes: 47 additions & 2 deletions docs/api_docs/platform/base/base_platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,20 @@ class ScrapliCfgBase:
conn: Union[NetworkDriver, AsyncNetworkDriver]

def __init__(self, config_sources: List[str], ignore_version: bool = False) -> None:
"""
Base class for all CFG platforms

Args:
config_sources: list of allowed config sources
ignore_version: ignore platform version check or not

Returns:
None

Raises:
N/A

"""
self.logger = get_instance_logger(
instance_name="scrapli_cfg.platform", host=self.conn.host, port=self.conn.port
)
Expand Down Expand Up @@ -591,7 +605,9 @@ class ScrapliCfgBase:
"""
diff_response.record_response(scrapli_responses=scrapli_responses)
diff_response.record_diff_response(
source_config=source_config, candidate_config=candidate_config, device_diff=device_diff
source_config=source_config + "\n",
candidate_config=candidate_config + "\n",
device_diff=device_diff,
)

if diff_response.failed:
Expand All @@ -611,6 +627,19 @@ class ScrapliCfgBase:
### ScrapliCfgBase


```text
Base class for all CFG platforms
Args:
config_sources: list of allowed config sources
ignore_version: ignore platform version check or not
Returns:
None
Raises:
N/A
```

<details class="source">
<summary>
Expand All @@ -622,6 +651,20 @@ class ScrapliCfgBase:
conn: Union[NetworkDriver, AsyncNetworkDriver]

def __init__(self, config_sources: List[str], ignore_version: bool = False) -> None:
"""
Base class for all CFG platforms

Args:
config_sources: list of allowed config sources
ignore_version: ignore platform version check or not

Returns:
None

Raises:
N/A

"""
self.logger = get_instance_logger(
instance_name="scrapli_cfg.platform", host=self.conn.host, port=self.conn.port
)
Expand Down Expand Up @@ -1159,7 +1202,9 @@ class ScrapliCfgBase:
"""
diff_response.record_response(scrapli_responses=scrapli_responses)
diff_response.record_diff_response(
source_config=source_config, candidate_config=candidate_config, device_diff=device_diff
source_config=source_config + "\n",
candidate_config=candidate_config + "\n",
device_diff=device_diff,
)

if diff_response.failed:
Expand Down
4 changes: 2 additions & 2 deletions docs/api_docs/platform/base/sync_platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ Raises:


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

```text
Cleanup after scrapli-cfg operations
Expand Down Expand Up @@ -934,7 +934,7 @@ Raises:


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

```text
Prepare connection for scrapli_cfg operations
Expand Down
16 changes: 4 additions & 12 deletions docs/api_docs/platform/core/arista_eos/async_platform.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,15 +308,11 @@ class AsyncScrapliCfgEOS(AsyncScrapliCfgPlatform, ScrapliCfgEOSBase):
except DiffConfigError:
pass

source_config, candidate_config = self._normalize_source_candidate_configs(
source_config=source_config
)

return self._post_diff_config(
diff_response=diff_response,
scrapli_responses=scrapli_responses,
source_config=source_config,
candidate_config=candidate_config,
source_config=self.clean_config(source_config),
candidate_config=self.clean_config(self.candidate_config),
device_diff=device_diff,
)
</code>
Expand Down Expand Up @@ -634,15 +630,11 @@ class AsyncScrapliCfgEOS(AsyncScrapliCfgPlatform, ScrapliCfgEOSBase):
except DiffConfigError:
pass

source_config, candidate_config = self._normalize_source_candidate_configs(
source_config=source_config
)

return self._post_diff_config(
diff_response=diff_response,
scrapli_responses=scrapli_responses,
source_config=source_config,
candidate_config=candidate_config,
source_config=self.clean_config(source_config),
candidate_config=self.clean_config(self.candidate_config),
device_diff=device_diff,
)
</code>
Expand Down
Loading

0 comments on commit db30c5f

Please sign in to comment.