!26 回退 'Pull Request !25 : ConfigShell support passing Console object as parameter'

From: @lyn1001 
Reviewed-by: @caodongxia 
Signed-off-by: @caodongxia
This commit is contained in:
openeuler-ci-bot 2023-12-12 01:58:41 +00:00 committed by Gitee
commit 5722fe7bb0
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 1 additions and 47 deletions

View File

@ -1,41 +0,0 @@
From fd17712b84cbb896e7532a20e5f1f691e4c33479 Mon Sep 17 00:00:00 2001
From: "mingzhe.zou@easystack.cn" <mingzhe.zou@easystack.cn>
Date: Fri, 22 Oct 2021 12:46:05 +0800
Subject: [PATCH] ConfigShell support passing Console object as parameter
Setting preference maybe rollback when execute multiple targetcli requests concurrently.
Please see https://github.com/open-iscsi/targetcli-fb/issues/188 for details.
In order to solve this problem we must first initialize a Console object.
Signed-off-by: Zou Mingzhe <mingzhe.zou@easystack.cn>
---
configshell/shell.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/configshell/shell.py b/configshell/shell.py
index 437186d..be84b40 100644
--- a/configshell/shell.py
+++ b/configshell/shell.py
@@ -101,7 +101,7 @@ class ConfigShell(object):
_current_token = ''
_current_completions = []
- def __init__(self, preferences_dir=None):
+ def __init__(self, preferences_dir=None, console=None):
'''
Creates a new ConfigShell.
@param preferences_dir: Directory to load/save preferences from/to
@@ -177,7 +177,9 @@ class ConfigShell(object):
if pref not in self.prefs:
self.prefs[pref] = value
- self.con = console.Console()
+ if console is None:
+ console = console.Console()
+ self.con = console
# Private methods
--
2.42.0.windows.2

View File

@ -4,14 +4,12 @@
Name: python-configshell Name: python-configshell
Summary: Python library that provides a framework for building simple but nice CLI-based applications. Summary: Python library that provides a framework for building simple but nice CLI-based applications.
Version: 1.1.27 Version: 1.1.27
Release: 4 Release: 3
License: ASL 2.0 License: ASL 2.0
URL: https://github.com/open-iscsi/configshell-fb URL: https://github.com/open-iscsi/configshell-fb
Source0: https://github.com/open-iscsi/configshell-fb/archive/v1.1.27.tar.gz Source0: https://github.com/open-iscsi/configshell-fb/archive/v1.1.27.tar.gz
BuildArch: noarch BuildArch: noarch
Patch0001: 0001-ConfigShell-support-passing-Console-object-as-parame.patch
%global _description\ %global _description\
%{name} is a Python library that provides a framework for building simple but nice CLI-based applications.\ %{name} is a Python library that provides a framework for building simple but nice CLI-based applications.\
This runs with Python 3 and python 3 is run by setup.py to run on Python 3.\ This runs with Python 3 and python 3 is run by setup.py to run on Python 3.\
@ -49,9 +47,6 @@ popd
%doc README.md %doc README.md
%changelog %changelog
* Tue Dec 5 2023 liubo <liubo1@xfusion.com> - 1.1.27-4
- ConfigShell support passing Console object as parameter
* Mon Dec 06 2021 xu_ping <xuping33@huawei.com> - 1.1.27-3 * Mon Dec 06 2021 xu_ping <xuping33@huawei.com> - 1.1.27-3
- delete python2 - delete python2