From e47a451489a094abfcebfaae610414c75387cdf8 Mon Sep 17 00:00:00 2001 From: Carl Montanari Date: Thu, 22 Apr 2021 07:49:15 -0700 Subject: [PATCH] bump pytest-asyncio, fix save cfg on iosxe when file prompt mode changes, bump another pre release --- requirements-dev.txt | 2 +- .../platform/core/cisco_iosxe/async_platform.py | 11 +++++------ .../platform/core/cisco_iosxe/sync_platform.py | 11 +++++------ setup.py | 2 +- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 1a91d5f..42bcef7 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -8,7 +8,7 @@ pydocstyle==6.0.0 pyfakefs==4.4.0 pylama==7.7.1 pylint==2.7.4 -pytest-asyncio==0.14.0 +pytest-asyncio==0.15.0 pytest-cov==2.11.1 pytest==6.2.3 scrapli-replay==2021.7.30a4 diff --git a/scrapli_cfg/platform/core/cisco_iosxe/async_platform.py b/scrapli_cfg/platform/core/cisco_iosxe/async_platform.py index b4f986e..4ba2cee 100644 --- a/scrapli_cfg/platform/core/cisco_iosxe/async_platform.py +++ b/scrapli_cfg/platform/core/cisco_iosxe/async_platform.py @@ -228,13 +228,12 @@ async def abort_config(self) -> ScrapliCfgResponse: return self._post_abort_config(response=response, scrapli_responses=[abort_result]) - async def save_config(self, file_prompt_mode: Optional[FilePromptMode] = None) -> Response: + async def save_config(self) -> Response: """ Save the config -- "copy run start"! Args: - file_prompt_mode: optionally provide the file prompt mode, if its None we will fetch it - to decide if we need to use interactive mode or not + N/A Returns: Response: scrapli response object @@ -243,8 +242,8 @@ async def save_config(self, file_prompt_mode: Optional[FilePromptMode] = None) - N/A """ - if file_prompt_mode is None: - file_prompt_mode = await self._determine_file_prompt_mode() + # we always re-check file prompt mode because it could have changed! + file_prompt_mode = await self._determine_file_prompt_mode() if file_prompt_mode == FilePromptMode.ALERT: save_events = [ @@ -338,7 +337,7 @@ async def commit_config(self, source: str = "running") -> ScrapliCfgResponse: scrapli_responses.append(commit_result) - save_config_result = await self.save_config(file_prompt_mode=file_prompt_mode) + save_config_result = await self.save_config() scrapli_responses.append(save_config_result) if self.cleanup_post_commit: diff --git a/scrapli_cfg/platform/core/cisco_iosxe/sync_platform.py b/scrapli_cfg/platform/core/cisco_iosxe/sync_platform.py index b7e411a..bbfb7ba 100644 --- a/scrapli_cfg/platform/core/cisco_iosxe/sync_platform.py +++ b/scrapli_cfg/platform/core/cisco_iosxe/sync_platform.py @@ -227,13 +227,12 @@ def abort_config(self) -> ScrapliCfgResponse: return self._post_abort_config(response=response, scrapli_responses=[abort_result]) - def save_config(self, file_prompt_mode: Optional[FilePromptMode] = None) -> Response: + def save_config(self) -> Response: """ Save the config -- "copy run start"! Args: - file_prompt_mode: optionally provide the file prompt mode, if its None we will fetch it - to decide if we need to use interactive mode or not + N/A Returns: Response: scrapli response object @@ -242,8 +241,8 @@ def save_config(self, file_prompt_mode: Optional[FilePromptMode] = None) -> Resp N/A """ - if file_prompt_mode is None: - file_prompt_mode = self._determine_file_prompt_mode() + # we always re-check file prompt mode because it could have changed! + file_prompt_mode = self._determine_file_prompt_mode() if file_prompt_mode == FilePromptMode.ALERT: save_events = [ @@ -335,7 +334,7 @@ def commit_config(self, source: str = "running") -> ScrapliCfgResponse: scrapli_responses.append(commit_result) - save_config_result = self.save_config(file_prompt_mode=file_prompt_mode) + save_config_result = self.save_config() scrapli_responses.append(save_config_result) if self.cleanup_post_commit: diff --git a/setup.py b/setup.py index f20d6c7..9e9952f 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ import setuptools -__version__ = "2021.07.30a6" +__version__ = "2021.07.30a7" __author__ = "Carl Montanari" with open("README.md", "r", encoding="utf-8") as f: