Skip to content

Commit e1bb784

Browse files
Dev fix- 4.0.1 (#564)
* fix * f2 * Version 4.0.1
1 parent dea0242 commit e1bb784

File tree

4 files changed

+30
-21
lines changed

4 files changed

+30
-21
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## moler 4.0.1
2+
* UnixRemote - change the Exception when wrong configuration
3+
14
## moler 4.0.0
25
* Exchange state machines for devices (conditionally delete state PROXY_PC as default)
36

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![image](https://img.shields.io/badge/pypi-v4.0.0-blue.svg)](https://pypi.org/project/moler/)
1+
[![image](https://img.shields.io/badge/pypi-v4.0.1-blue.svg)](https://pypi.org/project/moler/)
22
[![image](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11%20%7C%203.12%20%7C%203.13-blue.svg)](https://pypi.org/project/moler/)
33
[![Build Status](https://github.com/nokia/moler/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/nokia/moler/actions)
44
[![License](https://img.shields.io/badge/License-BSD%203--Clause-blue.svg)](./LICENSE)

moler/device/unixremote.py

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
__email__ = "marcin.usielski@nokia.com"
1111

1212

13-
import logging
1413
from moler.device.proxy_pc import ProxyPc
14+
from moler.exceptions import DeviceFailure
1515
from moler.helpers import (
1616
call_base_class_method_with_same_name,
1717
mark_to_call_base_class_method_with_same_name,
@@ -61,10 +61,10 @@ class UnixRemote(ProxyPc):
6161
UNIX_REMOTE:
6262
execute_command: ssh # default value
6363
command_params:
64-
expected_prompt: unix_remote_prompt
65-
host: host_ip
66-
login: login
67-
password: password
64+
expected_prompt: unix_remote_prompt
65+
host: host_ip
66+
login: login
67+
password: password
6868
6969
7070
"""
@@ -116,21 +116,27 @@ def _overwrite_prompts(self):
116116
Overwrite prompts for some states to easily configure the SM.
117117
"""
118118
super(UnixRemote, self)._overwrite_prompts()
119-
if self._use_proxy_pc:
120-
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_remote][UnixRemote.proxy_pc][
121-
"command_params"]["expected_prompt"] = \
122-
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_local][UnixRemote.proxy_pc][
123-
"command_params"]["expected_prompt"]
119+
try:
120+
if self._use_proxy_pc:
121+
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_remote][UnixRemote.proxy_pc][
122+
"command_params"]["expected_prompt"] = \
123+
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_local][UnixRemote.proxy_pc][
124+
"command_params"]["expected_prompt"]
124125

125-
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_remote_root][UnixRemote.unix_remote][
126-
"command_params"]["expected_prompt"] = \
127-
self._configurations[UnixRemote.connection_hops][UnixRemote.proxy_pc][UnixRemote.unix_remote][
128-
"command_params"]["expected_prompt"]
129-
else:
130-
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_remote_root][UnixRemote.unix_remote][
131-
"command_params"]["expected_prompt"] = \
132-
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_local][UnixRemote.unix_remote][
133-
"command_params"]["expected_prompt"]
126+
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_remote_root][UnixRemote.unix_remote][
127+
"command_params"]["expected_prompt"] = \
128+
self._configurations[UnixRemote.connection_hops][UnixRemote.proxy_pc][UnixRemote.unix_remote][
129+
"command_params"]["expected_prompt"]
130+
else:
131+
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_remote_root][UnixRemote.unix_remote][
132+
"command_params"]["expected_prompt"] = \
133+
self._configurations[UnixRemote.connection_hops][UnixRemote.unix_local][UnixRemote.unix_remote][
134+
"command_params"]["expected_prompt"]
135+
except KeyError as ke:
136+
raise DeviceFailure(
137+
device=self.__class__.__name__,
138+
message=f"Wrong configuration. Cannot get prompts. {ke} {repr(ke)}"
139+
)
134140

135141
@mark_to_call_base_class_method_with_same_name
136142
def _get_default_sm_configuration_with_proxy_pc(self):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
setup(
1414
name='moler',
15-
version='4.0.0',
15+
version='4.0.1',
1616
description='Moler is a library for working with terminals, mainly for automated tests', # Required
1717
long_description=long_description,
1818
long_description_content_type='text/markdown',

0 commit comments

Comments
 (0)