From 5452e07c7bec222fd6a41546498d9e73bc809db5 Mon Sep 17 00:00:00 2001 From: Michal Ernst Date: Mon, 15 Oct 2018 14:33:31 +0200 Subject: [PATCH] Chane new_line_chars into newline_chars --- moler/cmd/commandtextualgeneric.py | 16 ++++++++-------- moler/cmd/unix/bash.py | 4 ++-- moler/cmd/unix/cat.py | 4 ++-- moler/cmd/unix/cd.py | 4 ++-- moler/cmd/unix/chgrp.py | 4 ++-- moler/cmd/unix/chmod.py | 4 ++-- moler/cmd/unix/chown.py | 4 ++-- moler/cmd/unix/cp.py | 4 ++-- moler/cmd/unix/date.py | 4 ++-- moler/cmd/unix/df.py | 4 ++-- moler/cmd/unix/dmesg.py | 4 ++-- moler/cmd/unix/echo.py | 4 ++-- moler/cmd/unix/enter.py | 4 ++-- moler/cmd/unix/env.py | 4 ++-- moler/cmd/unix/ethtool.py | 4 ++-- moler/cmd/unix/exit.py | 6 +++--- moler/cmd/unix/export.py | 4 ++-- moler/cmd/unix/find.py | 4 ++-- moler/cmd/unix/genericunix.py | 4 ++-- moler/cmd/unix/grep.py | 4 ++-- moler/cmd/unix/hciconfig.py | 4 ++-- moler/cmd/unix/hexdump.py | 4 ++-- moler/cmd/unix/hostname.py | 4 ++-- moler/cmd/unix/id.py | 4 ++-- moler/cmd/unix/ifconfig.py | 4 ++-- moler/cmd/unix/ip_addr.py | 4 ++-- moler/cmd/unix/ip_link.py | 4 ++-- moler/cmd/unix/ip_neigh.py | 4 ++-- moler/cmd/unix/ip_route.py | 4 ++-- moler/cmd/unix/iperf.py | 4 ++-- moler/cmd/unix/ipsec.py | 4 ++-- moler/cmd/unix/iptables.py | 4 ++-- moler/cmd/unix/kill.py | 4 ++-- moler/cmd/unix/killall.py | 4 ++-- moler/cmd/unix/ln.py | 4 ++-- moler/cmd/unix/ls.py | 4 ++-- moler/cmd/unix/md5sum.py | 4 ++-- moler/cmd/unix/mkdir.py | 4 ++-- moler/cmd/unix/mount.py | 4 ++-- moler/cmd/unix/mpstat.py | 4 ++-- moler/cmd/unix/mv.py | 4 ++-- moler/cmd/unix/nmap.py | 4 ++-- moler/cmd/unix/ntpq.py | 4 ++-- moler/cmd/unix/ping.py | 4 ++-- moler/cmd/unix/pkill.py | 4 ++-- moler/cmd/unix/ps.py | 4 ++-- moler/cmd/unix/pwd.py | 4 ++-- moler/cmd/unix/rm.py | 4 ++-- moler/cmd/unix/route.py | 4 ++-- moler/cmd/unix/run_script.py | 4 ++-- moler/cmd/unix/scp.py | 4 ++-- moler/cmd/unix/sed.py | 4 ++-- moler/cmd/unix/service.py | 4 ++-- moler/cmd/unix/socat.py | 4 ++-- moler/cmd/unix/ssh.py | 6 +++--- moler/cmd/unix/su.py | 4 ++-- moler/cmd/unix/tail.py | 4 ++-- moler/cmd/unix/tar.py | 4 ++-- moler/cmd/unix/telnet.py | 4 ++-- moler/cmd/unix/top.py | 4 ++-- moler/cmd/unix/tshark.py | 4 ++-- moler/cmd/unix/uname.py | 4 ++-- moler/cmd/unix/uptime.py | 4 ++-- moler/cmd/unix/useradd.py | 4 ++-- moler/cmd/unix/userdel.py | 4 ++-- moler/cmd/unix/which.py | 4 ++-- moler/cmd/unix/whoami.py | 4 ++-- moler/cmd/unix/zip.py | 4 ++-- moler/events/textualevent.py | 8 ++++---- test/unix/test_cmd_echo.py | 2 +- test/unix/test_cmd_su.py | 2 +- test/unix/test_cmd_useradd.py | 8 ++++---- test/unix/test_cmd_userdel.py | 8 ++++---- 73 files changed, 158 insertions(+), 158 deletions(-) diff --git a/moler/cmd/commandtextualgeneric.py b/moler/cmd/commandtextualgeneric.py index aea0344a2..ed14e773e 100644 --- a/moler/cmd/commandtextualgeneric.py +++ b/moler/cmd/commandtextualgeneric.py @@ -19,13 +19,13 @@ class CommandTextualGeneric(Command): _re_default_prompt = re.compile(r'^[^<]*[\$|%|#|>|~]\s*$') # When user provides no prompt - _default_new_line_chars = ("\n", "\r") # New line chars on device, not system with script! + _default_newline_chars = ("\n", "\r") # New line chars on device, not system with script! - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): + def __init__(self, connection, prompt=None, newline_chars=None, runner=None): """ :param connection: connection to device :param prompt: expected prompt sending by device after command execution. Maybe String or compiled re - :param new_line_chars: new line chars on device + :param newline_chars: new line chars on device """ super(CommandTextualGeneric, self).__init__(connection=connection, runner=runner) self.__command_string = None # String representing command on device @@ -37,9 +37,9 @@ def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): self.break_on_timeout = True # If True then Ctrl+c on timeout self._last_not_full_line = None # Part of line self._re_prompt = CommandTextualGeneric._calculate_prompt(prompt) # Expected prompt on device - self._new_line_chars = new_line_chars # New line characters on device - if not self._new_line_chars: - self._new_line_chars = CommandTextualGeneric._default_new_line_chars + self._newline_chars = newline_chars # New line characters on device + if not self._newline_chars: + self._newline_chars = CommandTextualGeneric._default_newline_chars @property def command_string(self): @@ -67,7 +67,7 @@ def has_endline_char(self, line): :param line: String to check :return: True if any new line char was found, False otherwise """ - if line.endswith(self._new_line_chars): + if line.endswith(self._newline_chars): return True return False @@ -125,7 +125,7 @@ def _strip_new_lines_chars(self, line): :param line: line from device :return: line without new lines chars """ - for char in self._new_line_chars: + for char in self._newline_chars: line = line.rstrip(char) return line diff --git a/moler/cmd/unix/bash.py b/moler/cmd/unix/bash.py index d2770bde9..32d6b1d9e 100644 --- a/moler/cmd/unix/bash.py +++ b/moler/cmd/unix/bash.py @@ -13,8 +13,8 @@ class Bash(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None, bash="TERM=xterm-mono bash"): - super(Bash, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, runner=None, bash="TERM=xterm-mono bash"): + super(Bash, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.bash = bash self.ret_required = False diff --git a/moler/cmd/unix/cat.py b/moler/cmd/unix/cat.py index 78f19f953..66a2d6812 100644 --- a/moler/cmd/unix/cat.py +++ b/moler/cmd/unix/cat.py @@ -13,8 +13,8 @@ class Cat(GenericUnixCommand): - def __init__(self, connection, path, options=None, prompt=None, new_line_chars=None, runner=None): - super(Cat, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, path, options=None, prompt=None, newline_chars=None, runner=None): + super(Cat, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.path = path self.options = options self.current_ret["LINES"] = [] diff --git a/moler/cmd/unix/cd.py b/moler/cmd/unix/cd.py index ac3eb8d82..93caf01b6 100644 --- a/moler/cmd/unix/cd.py +++ b/moler/cmd/unix/cd.py @@ -14,8 +14,8 @@ class Cd(GenericUnixCommand): - def __init__(self, connection, path=None, prompt=None, new_line_chars=None, runner=None): - super(Cd, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, path=None, prompt=None, newline_chars=None, runner=None): + super(Cd, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.path = path diff --git a/moler/cmd/unix/chgrp.py b/moler/cmd/unix/chgrp.py index b9ed2f7e8..b7ffa20e8 100644 --- a/moler/cmd/unix/chgrp.py +++ b/moler/cmd/unix/chgrp.py @@ -15,8 +15,8 @@ class Chgrp(GenericUnixCommand): - def __init__(self, connection, files, group, options=None, prompt=None, new_line_chars=None, runner=None): - super(Chgrp, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, files, group, options=None, prompt=None, newline_chars=None, runner=None): + super(Chgrp, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.files = files self.group = group diff --git a/moler/cmd/unix/chmod.py b/moler/cmd/unix/chmod.py index 2d6449d91..ff5522645 100644 --- a/moler/cmd/unix/chmod.py +++ b/moler/cmd/unix/chmod.py @@ -13,8 +13,8 @@ class Chmod(GenericUnixCommand): - def __init__(self, connection, permission, filename, options=None, prompt=None, new_line_chars=None, runner=None): - super(Chmod, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, permission, filename, options=None, prompt=None, newline_chars=None, runner=None): + super(Chmod, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.permission = permission self.filename = filename self.options = options diff --git a/moler/cmd/unix/chown.py b/moler/cmd/unix/chown.py index 4d426f2bc..d5d06e42a 100644 --- a/moler/cmd/unix/chown.py +++ b/moler/cmd/unix/chown.py @@ -13,8 +13,8 @@ class Chown(GenericUnixCommand): - def __init__(self, connection, param, filename, options=None, prompt=None, new_line_chars=None, runner=None): - super(Chown, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, param, filename, options=None, prompt=None, newline_chars=None, runner=None): + super(Chown, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.param = param self.filename = filename self.options = options diff --git a/moler/cmd/unix/cp.py b/moler/cmd/unix/cp.py index e27843544..a339ef01b 100644 --- a/moler/cmd/unix/cp.py +++ b/moler/cmd/unix/cp.py @@ -13,8 +13,8 @@ class Cp(GenericUnixCommand): - def __init__(self, connection, src, dst, options=None, prompt=None, new_line_chars=None, runner=None): - super(Cp, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, src, dst, options=None, prompt=None, newline_chars=None, runner=None): + super(Cp, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.src = src self.dst = dst diff --git a/moler/cmd/unix/date.py b/moler/cmd/unix/date.py index e0de70e63..0ee928915 100644 --- a/moler/cmd/unix/date.py +++ b/moler/cmd/unix/date.py @@ -13,8 +13,8 @@ class Date(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): - super(Date, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, runner=None): + super(Date, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command diff --git a/moler/cmd/unix/df.py b/moler/cmd/unix/df.py index f2b9ee3cb..e32c000b7 100644 --- a/moler/cmd/unix/df.py +++ b/moler/cmd/unix/df.py @@ -16,8 +16,8 @@ class Df(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): - super(Df, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, runner=None): + super(Df, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self._converter_helper = ConverterHelper() def build_command_string(self): diff --git a/moler/cmd/unix/dmesg.py b/moler/cmd/unix/dmesg.py index a61796aec..a2a573ad4 100644 --- a/moler/cmd/unix/dmesg.py +++ b/moler/cmd/unix/dmesg.py @@ -11,8 +11,8 @@ class Dmesg(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Dmesg, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Dmesg, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.current_ret["LINES"] = [] diff --git a/moler/cmd/unix/echo.py b/moler/cmd/unix/echo.py index 5c9edd897..b5b60a408 100644 --- a/moler/cmd/unix/echo.py +++ b/moler/cmd/unix/echo.py @@ -13,8 +13,8 @@ class Echo(GenericUnixCommand): def __init__(self, connection, options=None, text=None, write_mode=">", output_file=None, prompt=None, - new_line_chars=None, runner=None): - super(Echo, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + newline_chars=None, runner=None): + super(Echo, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.text = text diff --git a/moler/cmd/unix/enter.py b/moler/cmd/unix/enter.py index 5fa2bf79f..61c592f41 100644 --- a/moler/cmd/unix/enter.py +++ b/moler/cmd/unix/enter.py @@ -13,8 +13,8 @@ class Enter(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): - super(Enter, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, runner=None): + super(Enter, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.ret_required = False def build_command_string(self): diff --git a/moler/cmd/unix/env.py b/moler/cmd/unix/env.py index 63aaa089d..3cd289b5b 100644 --- a/moler/cmd/unix/env.py +++ b/moler/cmd/unix/env.py @@ -15,8 +15,8 @@ class Env(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): - super(Env, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, runner=None): + super(Env, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.ret_required = True def build_command_string(self): diff --git a/moler/cmd/unix/ethtool.py b/moler/cmd/unix/ethtool.py index 34231fdd8..87efdcd0f 100644 --- a/moler/cmd/unix/ethtool.py +++ b/moler/cmd/unix/ethtool.py @@ -15,8 +15,8 @@ class Ethtool(GenericUnixCommand): - def __init__(self, connection, interface, prompt=None, new_line_chars=None, options=None, runner=None): - super(Ethtool, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, interface, prompt=None, newline_chars=None, options=None, runner=None): + super(Ethtool, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.interface = interface self.options = options diff --git a/moler/cmd/unix/exit.py b/moler/cmd/unix/exit.py index fa571f210..5862076fa 100644 --- a/moler/cmd/unix/exit.py +++ b/moler/cmd/unix/exit.py @@ -13,14 +13,14 @@ class Exit(GenericUnixCommand): - def __init__(self, connection, prompt=None, expected_prompt='>', new_line_chars=None, runner=None, target_newline="\n"): + def __init__(self, connection, prompt=None, expected_prompt='>', newline_chars=None, runner=None, target_newline="\n"): """ :param connection: :param prompt: Prompt of the starting shell :param expected_prompt: Prompt of the target shell reached after exit command - :param new_line_chars: + :param newline_chars: """ - super(Exit, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Exit, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.ret_required = False self.target_newline = target_newline diff --git a/moler/cmd/unix/export.py b/moler/cmd/unix/export.py index 24efdbdb5..a6f1ddc50 100644 --- a/moler/cmd/unix/export.py +++ b/moler/cmd/unix/export.py @@ -15,8 +15,8 @@ class Export(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, ps1_param=None, set_param=None, runner=None): - super(Export, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, ps1_param=None, set_param=None, runner=None): + super(Export, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) if ps1_param or set_param: self.ret_required = False else: diff --git a/moler/cmd/unix/find.py b/moler/cmd/unix/find.py index 8b5f5754a..a24f889f5 100644 --- a/moler/cmd/unix/find.py +++ b/moler/cmd/unix/find.py @@ -15,9 +15,9 @@ class Find(GenericUnixCommand): - def __init__(self, connection, paths=[], prompt=None, new_line_chars=None, options=None, operators=None, + def __init__(self, connection, paths=[], prompt=None, newline_chars=None, options=None, operators=None, runner=None): - super(Find, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Find, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.operators = operators self.paths = copy.copy(paths) diff --git a/moler/cmd/unix/genericunix.py b/moler/cmd/unix/genericunix.py index 84393c9e7..86520edca 100644 --- a/moler/cmd/unix/genericunix.py +++ b/moler/cmd/unix/genericunix.py @@ -17,8 +17,8 @@ class GenericUnixCommand(CommandTextualGeneric): _re_fail = re.compile(r'command not found|No such file or directory|running it may require superuser privileges') - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): - super(GenericUnixCommand, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, prompt=None, newline_chars=None, runner=None): + super(GenericUnixCommand, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.remove_colors_from_terminal_output = True diff --git a/moler/cmd/unix/grep.py b/moler/cmd/unix/grep.py index 26513bf6a..5a64fea6b 100644 --- a/moler/cmd/unix/grep.py +++ b/moler/cmd/unix/grep.py @@ -16,8 +16,8 @@ class Grep(GenericUnixCommand): - def __init__(self, connection, options, prompt=None, new_line_chars=None, runner=None): - super(Grep, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options, prompt=None, newline_chars=None, runner=None): + super(Grep, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self._convert_helper = ConverterHelper() # Parameters defined by calling the command self.options = options diff --git a/moler/cmd/unix/hciconfig.py b/moler/cmd/unix/hciconfig.py index 7a24f35aa..5a7abd2fe 100644 --- a/moler/cmd/unix/hciconfig.py +++ b/moler/cmd/unix/hciconfig.py @@ -14,8 +14,8 @@ class Hciconfig(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Hciconfig, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Hciconfig, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.if_name = None self.options = options diff --git a/moler/cmd/unix/hexdump.py b/moler/cmd/unix/hexdump.py index 162061fc1..f11242da3 100644 --- a/moler/cmd/unix/hexdump.py +++ b/moler/cmd/unix/hexdump.py @@ -14,8 +14,8 @@ class Hexdump(GenericUnixCommand): - def __init__(self, connection, files, options=None, prompt=None, new_line_chars=None, runner=None): - super(Hexdump, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, files, options=None, prompt=None, newline_chars=None, runner=None): + super(Hexdump, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.files = files diff --git a/moler/cmd/unix/hostname.py b/moler/cmd/unix/hostname.py index 59b07e882..14a9da4c4 100644 --- a/moler/cmd/unix/hostname.py +++ b/moler/cmd/unix/hostname.py @@ -15,8 +15,8 @@ class Hostname(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Hostname, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Hostname, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options diff --git a/moler/cmd/unix/id.py b/moler/cmd/unix/id.py index e9ce04a6f..63db0b7b5 100644 --- a/moler/cmd/unix/id.py +++ b/moler/cmd/unix/id.py @@ -15,8 +15,8 @@ class Id(GenericUnixCommand): - def __init__(self, connection, user=None, prompt=None, new_line_chars=None, runner=None): - super(Id, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, user=None, prompt=None, newline_chars=None, runner=None): + super(Id, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.user = user diff --git a/moler/cmd/unix/ifconfig.py b/moler/cmd/unix/ifconfig.py index ebbff55bf..a64a36077 100644 --- a/moler/cmd/unix/ifconfig.py +++ b/moler/cmd/unix/ifconfig.py @@ -14,8 +14,8 @@ class Ifconfig(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Ifconfig, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Ifconfig, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.ret_required = False diff --git a/moler/cmd/unix/ip_addr.py b/moler/cmd/unix/ip_addr.py index 8b27083e9..97c6a7e11 100644 --- a/moler/cmd/unix/ip_addr.py +++ b/moler/cmd/unix/ip_addr.py @@ -14,8 +14,8 @@ class IpAddr(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(IpAddr, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(IpAddr, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.if_name = None self.options = options diff --git a/moler/cmd/unix/ip_link.py b/moler/cmd/unix/ip_link.py index 67f67d1bb..0dd67ee07 100644 --- a/moler/cmd/unix/ip_link.py +++ b/moler/cmd/unix/ip_link.py @@ -14,8 +14,8 @@ class IpLink(GenericUnixCommand): - def __init__(self, connection, action, prompt=None, new_line_chars=None, options=None, runner=None): - super(IpLink, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, action, prompt=None, newline_chars=None, options=None, runner=None): + super(IpLink, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.ret_required = False self.action = action self.options = options diff --git a/moler/cmd/unix/ip_neigh.py b/moler/cmd/unix/ip_neigh.py index 7c43563dc..de3f34920 100644 --- a/moler/cmd/unix/ip_neigh.py +++ b/moler/cmd/unix/ip_neigh.py @@ -14,8 +14,8 @@ class IpNeigh(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(IpNeigh, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(IpNeigh, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.ret_required = False diff --git a/moler/cmd/unix/ip_route.py b/moler/cmd/unix/ip_route.py index b4a860937..0d5eace88 100644 --- a/moler/cmd/unix/ip_route.py +++ b/moler/cmd/unix/ip_route.py @@ -16,9 +16,9 @@ class IpRoute(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None, is_ipv6=False, addr_get=None, + def __init__(self, connection, prompt=None, newline_chars=None, runner=None, is_ipv6=False, addr_get=None, addr_from=None): - super(IpRoute, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + super(IpRoute, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self._converter_helper = ConverterHelper() # Parameters defined by calling the command diff --git a/moler/cmd/unix/iperf.py b/moler/cmd/unix/iperf.py index a46560fe0..67c7cdea9 100644 --- a/moler/cmd/unix/iperf.py +++ b/moler/cmd/unix/iperf.py @@ -16,8 +16,8 @@ class Iperf(GenericUnixCommand): - def __init__(self, connection, options, prompt=None, new_line_chars=None, runner=None): - super(Iperf, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options, prompt=None, newline_chars=None, runner=None): + super(Iperf, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.current_ret['CONNECTIONS'] = dict() self.current_ret['INFO'] = list() diff --git a/moler/cmd/unix/ipsec.py b/moler/cmd/unix/ipsec.py index 47e2edb4e..4cf8a24f3 100644 --- a/moler/cmd/unix/ipsec.py +++ b/moler/cmd/unix/ipsec.py @@ -15,8 +15,8 @@ class Ipsec(GenericUnixCommand): - def __init__(self, connection, options, prompt=None, new_line_chars=None, runner=None): - super(Ipsec, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options, prompt=None, newline_chars=None, runner=None): + super(Ipsec, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.ret_required = False diff --git a/moler/cmd/unix/iptables.py b/moler/cmd/unix/iptables.py index 0eb3bcdad..d5bea8874 100644 --- a/moler/cmd/unix/iptables.py +++ b/moler/cmd/unix/iptables.py @@ -14,8 +14,8 @@ class Iptables(GenericUnixCommand): - def __init__(self, connection, options=None, v6=None, prompt=None, new_line_chars=None, runner=None): - super(Iptables, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, options=None, v6=None, prompt=None, newline_chars=None, runner=None): + super(Iptables, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.v6 = v6 diff --git a/moler/cmd/unix/kill.py b/moler/cmd/unix/kill.py index 27832a30a..11b035699 100644 --- a/moler/cmd/unix/kill.py +++ b/moler/cmd/unix/kill.py @@ -15,8 +15,8 @@ class Kill(GenericUnixCommand): - def __init__(self, connection, pid, options=None, prompt=None, new_line_chars=None, runner=None): - super(Kill, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, pid, options=None, prompt=None, newline_chars=None, runner=None): + super(Kill, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.pid = pid self.options = options self.ret_required = False diff --git a/moler/cmd/unix/killall.py b/moler/cmd/unix/killall.py index 9d82e34c8..15ba9c4cd 100644 --- a/moler/cmd/unix/killall.py +++ b/moler/cmd/unix/killall.py @@ -16,8 +16,8 @@ class Killall(GenericUnixCommand): - def __init__(self, connection, name, is_verbose=False, prompt=None, new_line_chars=None, runner=None): - super(Killall, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, name, is_verbose=False, prompt=None, newline_chars=None, runner=None): + super(Killall, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.is_verbose = is_verbose self.name = name diff --git a/moler/cmd/unix/ln.py b/moler/cmd/unix/ln.py index 83da0a8cb..161599acd 100644 --- a/moler/cmd/unix/ln.py +++ b/moler/cmd/unix/ln.py @@ -15,8 +15,8 @@ class Ln(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, options=None, runner=None): - super(Ln, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, options=None, runner=None): + super(Ln, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options self.ret_required = False diff --git a/moler/cmd/unix/ls.py b/moler/cmd/unix/ls.py index 36f7b641a..5b13fde56 100644 --- a/moler/cmd/unix/ls.py +++ b/moler/cmd/unix/ls.py @@ -20,8 +20,8 @@ class Ls(GenericUnixCommand): _re_long = re.compile(r"([\w-]{10})\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S.*\S)\s+(\S+)\s*$") _re_long_links = re.compile(r"([\w-]{10})\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S.*\S)\s+(\S+)\s+->\s+(\S+)\s*$") - def __init__(self, connection, prompt=None, new_line_chars=None, options=None, runner=None): - super(Ls, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, options=None, runner=None): + super(Ls, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self._converter_helper = ConverterHelper() # Parameters defined by calling the command self.options = options diff --git a/moler/cmd/unix/md5sum.py b/moler/cmd/unix/md5sum.py index c84f730a8..2047770fc 100644 --- a/moler/cmd/unix/md5sum.py +++ b/moler/cmd/unix/md5sum.py @@ -12,8 +12,8 @@ class Md5sum(GenericUnixCommand): - def __init__(self, connection, path, options=None, prompt=None, new_line_chars=None, runner=None): - super(Md5sum, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, path, options=None, prompt=None, newline_chars=None, runner=None): + super(Md5sum, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.path = path self.options = options diff --git a/moler/cmd/unix/mkdir.py b/moler/cmd/unix/mkdir.py index 71fff648b..32732b8c8 100644 --- a/moler/cmd/unix/mkdir.py +++ b/moler/cmd/unix/mkdir.py @@ -13,8 +13,8 @@ class Mkdir(GenericUnixCommand): - def __init__(self, connection, path, options=None, prompt=None, new_line_chars=None, runner=None): - super(Mkdir, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, path, options=None, prompt=None, newline_chars=None, runner=None): + super(Mkdir, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.path = path self.options = options self.ret_required = False diff --git a/moler/cmd/unix/mount.py b/moler/cmd/unix/mount.py index 9caeff4db..4a86a5c25 100644 --- a/moler/cmd/unix/mount.py +++ b/moler/cmd/unix/mount.py @@ -17,9 +17,9 @@ class Mount(GenericUnixCommand): - def __init__(self, connection, options=None, device=None, directory=None, prompt=None, new_line_chars=None, + def __init__(self, connection, options=None, device=None, directory=None, prompt=None, newline_chars=None, runner=None): - super(Mount, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Mount, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options diff --git a/moler/cmd/unix/mpstat.py b/moler/cmd/unix/mpstat.py index 3ac40638d..552ec4026 100644 --- a/moler/cmd/unix/mpstat.py +++ b/moler/cmd/unix/mpstat.py @@ -16,8 +16,8 @@ class Mpstat(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Mpstat, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Mpstat, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options self.ret_required = False diff --git a/moler/cmd/unix/mv.py b/moler/cmd/unix/mv.py index bb6e63d98..8a0e4ab1e 100644 --- a/moler/cmd/unix/mv.py +++ b/moler/cmd/unix/mv.py @@ -12,8 +12,8 @@ class Mv(GenericUnixCommand): - def __init__(self, connection, src, dst, options=None, prompt=None, new_line_chars=None, runner=None): - super(Mv, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, src, dst, options=None, prompt=None, newline_chars=None, runner=None): + super(Mv, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.src = src self.dst = dst diff --git a/moler/cmd/unix/nmap.py b/moler/cmd/unix/nmap.py index cad749835..1bc9373a2 100644 --- a/moler/cmd/unix/nmap.py +++ b/moler/cmd/unix/nmap.py @@ -15,8 +15,8 @@ class Nmap(GenericUnixCommand): - def __init__(self, connection, ip, is_ping=False, option=None, prompt=None, new_line_chars=None, runner=None): - super(Nmap, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, ip, is_ping=False, option=None, prompt=None, newline_chars=None, runner=None): + super(Nmap, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.option = option self.ip = ip self.is_ping = is_ping diff --git a/moler/cmd/unix/ntpq.py b/moler/cmd/unix/ntpq.py index b5d725633..678086e98 100644 --- a/moler/cmd/unix/ntpq.py +++ b/moler/cmd/unix/ntpq.py @@ -13,8 +13,8 @@ class Ntpq(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Ntpq, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Ntpq, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.headers = [] self.row_nr = 0 diff --git a/moler/cmd/unix/ping.py b/moler/cmd/unix/ping.py index b724022d6..385fa7ac5 100644 --- a/moler/cmd/unix/ping.py +++ b/moler/cmd/unix/ping.py @@ -15,8 +15,8 @@ class Ping(GenericUnixCommand): - def __init__(self, connection, destination, options=None, prompt=None, new_line_chars=None, runner=None): - super(Ping, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, destination, options=None, prompt=None, newline_chars=None, runner=None): + super(Ping, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options self.destination = destination diff --git a/moler/cmd/unix/pkill.py b/moler/cmd/unix/pkill.py index d6ea187c6..bcfc3681c 100644 --- a/moler/cmd/unix/pkill.py +++ b/moler/cmd/unix/pkill.py @@ -16,8 +16,8 @@ class Pkill(GenericUnixCommand): - def __init__(self, connection, name, prompt=None, new_line_chars=None, runner=None): - super(Pkill, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, name, prompt=None, newline_chars=None, runner=None): + super(Pkill, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.name = name self.ret_required = False diff --git a/moler/cmd/unix/ps.py b/moler/cmd/unix/ps.py index c1eba387d..1614926e3 100644 --- a/moler/cmd/unix/ps.py +++ b/moler/cmd/unix/ps.py @@ -22,7 +22,7 @@ class Ps(GenericUnixCommand): - def __init__(self, connection=None, options='', prompt=None, new_line_chars=None, runner=None): + def __init__(self, connection=None, options='', prompt=None, newline_chars=None, runner=None): self.parser = None self._cmd = 'ps' self._cmd_line_found = False @@ -30,7 +30,7 @@ def __init__(self, connection=None, options='', prompt=None, new_line_chars=None self._columns = list() self._space_columns = list() self._options = options - super(Ps, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Ps, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.current_ret = list() def on_new_line(self, line, is_full_line): diff --git a/moler/cmd/unix/pwd.py b/moler/cmd/unix/pwd.py index 118a21c0e..4957f9415 100644 --- a/moler/cmd/unix/pwd.py +++ b/moler/cmd/unix/pwd.py @@ -14,8 +14,8 @@ class Pwd(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): - super(Pwd, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, runner=None): + super(Pwd, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.ret_required = True def build_command_string(self): diff --git a/moler/cmd/unix/rm.py b/moler/cmd/unix/rm.py index c3a261ae5..ad07a0e89 100644 --- a/moler/cmd/unix/rm.py +++ b/moler/cmd/unix/rm.py @@ -12,8 +12,8 @@ class Rm(GenericUnixCommand): - def __init__(self, connection, file, options=None, prompt=None, new_line_chars=None, runner=None): - super(Rm, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, file, options=None, prompt=None, newline_chars=None, runner=None): + super(Rm, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.file = file self.options = options diff --git a/moler/cmd/unix/route.py b/moler/cmd/unix/route.py index c81534436..722447760 100644 --- a/moler/cmd/unix/route.py +++ b/moler/cmd/unix/route.py @@ -15,8 +15,8 @@ class Route(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, options=None, runner=None): - super(Route, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, options=None, runner=None): + super(Route, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.headers = [] self.values = [] diff --git a/moler/cmd/unix/run_script.py b/moler/cmd/unix/run_script.py index 110ea6588..be1d4fe21 100644 --- a/moler/cmd/unix/run_script.py +++ b/moler/cmd/unix/run_script.py @@ -15,8 +15,8 @@ class RunScript(GenericUnixCommand): - def __init__(self, connection, script_command, error_regex=re.compile("error", re.I), prompt=None, new_line_chars=None, runner=None): - super(RunScript, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, script_command, error_regex=re.compile("error", re.I), prompt=None, newline_chars=None, runner=None): + super(RunScript, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.script_command = script_command self.error_regex = error_regex diff --git a/moler/cmd/unix/scp.py b/moler/cmd/unix/scp.py index 61577c8fe..2261a060a 100644 --- a/moler/cmd/unix/scp.py +++ b/moler/cmd/unix/scp.py @@ -13,9 +13,9 @@ class Scp(GenericUnixCommand): - def __init__(self, connection, source, dest, password="", prompt=None, new_line_chars=None, + def __init__(self, connection, source, dest, password="", prompt=None, newline_chars=None, known_hosts_on_failure='keygen', encrypt_password=True, runner=None): - super(Scp, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Scp, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.source = source self.dest = dest self.password = password diff --git a/moler/cmd/unix/sed.py b/moler/cmd/unix/sed.py index a0470ff0d..66b760aad 100644 --- a/moler/cmd/unix/sed.py +++ b/moler/cmd/unix/sed.py @@ -17,9 +17,9 @@ class Sed(GenericUnixCommand): - def __init__(self, connection, input_files, prompt=None, new_line_chars=None, runner=None, options=None, + def __init__(self, connection, input_files, prompt=None, newline_chars=None, runner=None, options=None, scripts=None, script_files=None, output_file=None): - super(Sed, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Sed, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options # string or None diff --git a/moler/cmd/unix/service.py b/moler/cmd/unix/service.py index 9ca4ffa45..e93529498 100644 --- a/moler/cmd/unix/service.py +++ b/moler/cmd/unix/service.py @@ -15,8 +15,8 @@ class Service(GenericUnixCommand): - def __init__(self, connection, options, prompt=None, new_line_chars=None, runner=None): - super(Service, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, options, prompt=None, newline_chars=None, runner=None): + super(Service, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options diff --git a/moler/cmd/unix/socat.py b/moler/cmd/unix/socat.py index eff32124a..461ba5f8e 100644 --- a/moler/cmd/unix/socat.py +++ b/moler/cmd/unix/socat.py @@ -15,8 +15,8 @@ class Socat(GenericUnixCommand): def __init__(self, connection, input_options=None, output_options=None, options=None, prompt=None, - new_line_chars=None, runner=None): - super(Socat, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + newline_chars=None, runner=None): + super(Socat, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.input_options = input_options self.output_options = output_options self.options = options diff --git a/moler/cmd/unix/ssh.py b/moler/cmd/unix/ssh.py index b5484c249..c89e0a382 100644 --- a/moler/cmd/unix/ssh.py +++ b/moler/cmd/unix/ssh.py @@ -26,7 +26,7 @@ class Ssh(GenericUnixCommand): def __init__(self, connection, login, password, host, prompt=None, expected_prompt='>', port=0, known_hosts_on_failure='keygen', set_timeout=r'export TMOUT=\"2678400\"', set_prompt=None, - term_mono="TERM=xterm-mono", new_line_chars=None, encrypt_password=True, runner=None, + term_mono="TERM=xterm-mono", newline_chars=None, encrypt_password=True, runner=None, target_newline="\n"): """ @@ -41,12 +41,12 @@ def __init__(self, connection, login, password, host, prompt=None, expected_prom :param set_timeout: Command to set timeout after ssh connects :param set_prompt: Command to set prompt after ssh connects :param term_mono: Params to set ssh mono connection (useful in script) - :param new_line_chars: Characters to split lines + :param newline_chars: Characters to split lines :param encrypt_password: If True then * will be in logs when password is sent, otherwise plain text :param runner: Runner to run command :param target_newline: newline chars on remote system where ssh connects """ - super(Ssh, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Ssh, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self._re_expected_prompt = CommandTextualGeneric._calculate_prompt(expected_prompt) # Expected prompt on device diff --git a/moler/cmd/unix/su.py b/moler/cmd/unix/su.py index 9e5caa822..2b25871d8 100644 --- a/moler/cmd/unix/su.py +++ b/moler/cmd/unix/su.py @@ -18,8 +18,8 @@ class Su(GenericUnixCommand): def __init__(self, connection, user=None, options=None, password=None, prompt=None, expected_prompt=None, - new_line_chars=None, encrypt_password=True, runner=None): - super(Su, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + newline_chars=None, encrypt_password=True, runner=None): + super(Su, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.expected_prompt = expected_prompt diff --git a/moler/cmd/unix/tail.py b/moler/cmd/unix/tail.py index f91e3c576..515230d73 100644 --- a/moler/cmd/unix/tail.py +++ b/moler/cmd/unix/tail.py @@ -13,8 +13,8 @@ class Tail(GenericUnixCommand): - def __init__(self, connection, path, options=None, prompt=None, new_line_chars=None, runner=None): - super(Tail, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, path, options=None, prompt=None, newline_chars=None, runner=None): + super(Tail, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.path = path self.options = options self.current_ret["LINES"] = [] diff --git a/moler/cmd/unix/tar.py b/moler/cmd/unix/tar.py index cb13506de..d687ad295 100644 --- a/moler/cmd/unix/tar.py +++ b/moler/cmd/unix/tar.py @@ -12,8 +12,8 @@ class Tar(GenericUnixCommand): - def __init__(self, connection, options, file, prompt=None, new_line_chars=None, runner=None): - super(Tar, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options, file, prompt=None, newline_chars=None, runner=None): + super(Tar, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options self.file = file diff --git a/moler/cmd/unix/telnet.py b/moler/cmd/unix/telnet.py index 5c5772c66..2546ba49a 100644 --- a/moler/cmd/unix/telnet.py +++ b/moler/cmd/unix/telnet.py @@ -28,9 +28,9 @@ class Telnet(GenericUnixCommand): def __init__(self, connection, host, login=None, password=None, port=0, prompt=None, expected_prompt=r'^>\s*', set_timeout=r'export TMOUT=\"2678400\"', set_prompt=None, term_mono="TERM=xterm-mono", prefix=None, - new_line_chars=None, cmds_before_establish_connection=[], cmds_after_establish_connection=[], + newline_chars=None, cmds_before_establish_connection=[], cmds_after_establish_connection=[], telnet_prompt=r"^\s*telnet>\s*", encrypt_password=True, runner=None, target_newline="\n"): - super(Telnet, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Telnet, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self._re_expected_prompt = CommandTextualGeneric._calculate_prompt(expected_prompt) # Expected prompt on device diff --git a/moler/cmd/unix/top.py b/moler/cmd/unix/top.py index a5122d393..31e42bfbf 100644 --- a/moler/cmd/unix/top.py +++ b/moler/cmd/unix/top.py @@ -14,8 +14,8 @@ class Top(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Top, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Top, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self._processes_list_headers = list() self.current_ret = dict() diff --git a/moler/cmd/unix/tshark.py b/moler/cmd/unix/tshark.py index 488e37281..83d1dfd48 100644 --- a/moler/cmd/unix/tshark.py +++ b/moler/cmd/unix/tshark.py @@ -15,8 +15,8 @@ class Tshark(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Tshark, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Tshark, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options self.pckt_count = None diff --git a/moler/cmd/unix/uname.py b/moler/cmd/unix/uname.py index 7968dcae4..caca10d69 100644 --- a/moler/cmd/unix/uname.py +++ b/moler/cmd/unix/uname.py @@ -15,8 +15,8 @@ class Uname(GenericUnixCommand): - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Uname, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Uname, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options self.current_ret['RESULT'] = list() diff --git a/moler/cmd/unix/uptime.py b/moler/cmd/unix/uptime.py index 13fd6db6f..f849cd515 100644 --- a/moler/cmd/unix/uptime.py +++ b/moler/cmd/unix/uptime.py @@ -20,8 +20,8 @@ class Uptime(GenericUnixCommand): _re_hours_minutes = re.compile(r"(\d+):(\d+)") _re_minutes = re.compile(r"(\d+) min") - def __init__(self, connection, options=None, prompt=None, new_line_chars=None, runner=None): - super(Uptime, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, options=None, prompt=None, newline_chars=None, runner=None): + super(Uptime, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options diff --git a/moler/cmd/unix/useradd.py b/moler/cmd/unix/useradd.py index 48bf606e3..1e5f866f5 100644 --- a/moler/cmd/unix/useradd.py +++ b/moler/cmd/unix/useradd.py @@ -16,9 +16,9 @@ class Useradd(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None, options=None, defaults=False, + def __init__(self, connection, prompt=None, newline_chars=None, runner=None, options=None, defaults=False, user=None): - super(Useradd, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Useradd, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options diff --git a/moler/cmd/unix/userdel.py b/moler/cmd/unix/userdel.py index 774d14f90..cc7bedcef 100644 --- a/moler/cmd/unix/userdel.py +++ b/moler/cmd/unix/userdel.py @@ -16,8 +16,8 @@ class Userdel(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None, options=None, user=None): - super(Userdel, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, + def __init__(self, connection, prompt=None, newline_chars=None, runner=None, options=None, user=None): + super(Userdel, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) self.options = options diff --git a/moler/cmd/unix/which.py b/moler/cmd/unix/which.py index 7d27e39aa..f8330cc70 100644 --- a/moler/cmd/unix/which.py +++ b/moler/cmd/unix/which.py @@ -16,8 +16,8 @@ class Which(GenericUnixCommand): - def __init__(self, connection, names, show_all=None, prompt=None, new_line_chars=None, runner=None): - super(Which, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, names, show_all=None, prompt=None, newline_chars=None, runner=None): + super(Which, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.names = names diff --git a/moler/cmd/unix/whoami.py b/moler/cmd/unix/whoami.py index feb67e9ed..5048ff4a2 100644 --- a/moler/cmd/unix/whoami.py +++ b/moler/cmd/unix/whoami.py @@ -15,8 +15,8 @@ class Whoami(GenericUnixCommand): - def __init__(self, connection, prompt=None, new_line_chars=None, runner=None): - super(Whoami, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + def __init__(self, connection, prompt=None, newline_chars=None, runner=None): + super(Whoami, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) def build_command_string(self): cmd = "whoami" diff --git a/moler/cmd/unix/zip.py b/moler/cmd/unix/zip.py index d20aa572b..f839fe36f 100644 --- a/moler/cmd/unix/zip.py +++ b/moler/cmd/unix/zip.py @@ -16,9 +16,9 @@ class Zip(GenericUnixCommand): - def __init__(self, connection, options, file_name, zip_file, timeout=60, prompt=None, new_line_chars=None, + def __init__(self, connection, options, file_name, zip_file, timeout=60, prompt=None, newline_chars=None, runner=None): - super(Zip, self).__init__(connection=connection, prompt=prompt, new_line_chars=new_line_chars, runner=runner) + super(Zip, self).__init__(connection=connection, prompt=prompt, newline_chars=newline_chars, runner=runner) # Parameters defined by calling the command self.options = options self.file_name = file_name diff --git a/moler/events/textualevent.py b/moler/events/textualevent.py index 1de8e5789..663b959b4 100644 --- a/moler/events/textualevent.py +++ b/moler/events/textualevent.py @@ -8,12 +8,12 @@ class TextualEvent(Event): - _default_new_line_chars = ("\n", "\r") # New line chars on device, not system with script! + _default_newline_chars = ("\n", "\r") # New line chars on device, not system with script! def __init__(self, connection=None, till_occurs_times=-1): super(TextualEvent, self).__init__(connection=connection, till_occurs_times=till_occurs_times) self._last_not_full_line = None - self._new_line_chars = TextualEvent._default_new_line_chars + self._newline_chars = TextualEvent._default_newline_chars def event_occurred(self, event_data): self._consume_already_parsed_fragment() @@ -53,7 +53,7 @@ def is_new_line(self, line): :param line: String to check :return: True if any new line char was found, False otherwise """ - if line.endswith(self._new_line_chars): + if line.endswith(self._newline_chars): return True return False @@ -62,7 +62,7 @@ def _strip_new_lines_chars(self, line): :param line: line from device :return: line without new lines chars """ - for char in self._new_line_chars: + for char in self._newline_chars: line = line.rstrip(char) return line diff --git a/test/unix/test_cmd_echo.py b/test/unix/test_cmd_echo.py index eb2eda0f3..bd0b3ce0e 100644 --- a/test/unix/test_cmd_echo.py +++ b/test/unix/test_cmd_echo.py @@ -25,7 +25,7 @@ def test_echo_returns_proper_command_string_with_text(buffer_connection): assert "echo 'Hello my beautiful code!'" == echo_cmd.command_string -def test_echo_returns_proper_command_string_with_new_line_chars(buffer_connection): +def test_echo_returns_proper_command_string_with_newline_chars(buffer_connection): echo_cmd = Echo(connection=buffer_connection.moler_connection, options='-e', text='Hello \nmy \nbeautiful \ncode!') assert "echo -e 'Hello \\nmy \\nbeautiful \\ncode!'" == echo_cmd.command_string diff --git a/test/unix/test_cmd_su.py b/test/unix/test_cmd_su.py index 38e2b459a..3f23c2e3f 100644 --- a/test/unix/test_cmd_su.py +++ b/test/unix/test_cmd_su.py @@ -13,7 +13,7 @@ def test_su_returns_proper_command_string(buffer_connection): - telnet_cmd = Su(buffer_connection, user='xyz', options='-p', password="1234", prompt=None, new_line_chars=None) + telnet_cmd = Su(buffer_connection, user='xyz', options='-p', password="1234", prompt=None, newline_chars=None) assert "su -p xyz" == telnet_cmd.command_string diff --git a/test/unix/test_cmd_useradd.py b/test/unix/test_cmd_useradd.py index 4c8066d0d..033473dd7 100644 --- a/test/unix/test_cmd_useradd.py +++ b/test/unix/test_cmd_useradd.py @@ -15,13 +15,13 @@ def test_useradd_returns_proper_command_string_user(buffer_connection): useradd_cmd = Useradd(connection=buffer_connection.moler_connection, user='xyz', options='-p 1234', - prompt=None, new_line_chars=None) + prompt=None, newline_chars=None) assert "useradd -p 1234 xyz" == useradd_cmd.command_string def test_useradd_returns_proper_command_string_defaults(buffer_connection): useradd_cmd = Useradd(connection=buffer_connection.moler_connection, defaults=True, options='-e 2018-08-01', - prompt=None, new_line_chars=None) + prompt=None, newline_chars=None) assert "useradd -D -e 2018-08-01" == useradd_cmd.command_string @@ -29,7 +29,7 @@ def test_useradd_raise_command_error(buffer_connection, command_output_and_expec command_output, expected_result = command_output_and_expected_result_error buffer_connection.remote_inject_response([command_output]) useradd_cmd = Useradd(connection=buffer_connection.moler_connection, - defaults=True, options='-p', prompt=None, new_line_chars=None) + defaults=True, options='-p', prompt=None, newline_chars=None) assert "useradd -D -p" == useradd_cmd.command_string with pytest.raises(CommandFailure): useradd_cmd() @@ -39,7 +39,7 @@ def test_useradd_raise_command_error_with_help(buffer_connection, command_output command_output, expected_result = command_output_and_expected_result_error_help buffer_connection.remote_inject_response([command_output]) useradd_cmd = Useradd(connection=buffer_connection.moler_connection, - user='xyz', options='-p', prompt=None, new_line_chars=None) + user='xyz', options='-p', prompt=None, newline_chars=None) assert "useradd -p xyz" == useradd_cmd.command_string with pytest.raises(CommandFailure): useradd_cmd() diff --git a/test/unix/test_cmd_userdel.py b/test/unix/test_cmd_userdel.py index 6f117d6ae..a1df47617 100644 --- a/test/unix/test_cmd_userdel.py +++ b/test/unix/test_cmd_userdel.py @@ -15,13 +15,13 @@ def test_userdel_returns_proper_command_string(buffer_connection): - userdel_cmd = Userdel(connection=buffer_connection.moler_connection, user='xyz', prompt=None, new_line_chars=None) + userdel_cmd = Userdel(connection=buffer_connection.moler_connection, user='xyz', prompt=None, newline_chars=None) assert "userdel xyz" == userdel_cmd.command_string def test_userdel_returns_proper_command_string_with_option(buffer_connection): userdel_cmd = Userdel(connection=buffer_connection.moler_connection, user='xyz', options='-R CHROOT_DIR', - prompt=None, new_line_chars=None) + prompt=None, newline_chars=None) assert "userdel -R CHROOT_DIR xyz" == userdel_cmd.command_string @@ -29,7 +29,7 @@ def test_userdel_raises_command_error(buffer_connection, command_output_and_expe command_output, expected_result = command_output_and_expected_result buffer_connection.remote_inject_response([command_output]) userdel_cmd = Userdel(connection=buffer_connection.moler_connection, options='-p', user='tmp_user', prompt=None, - new_line_chars=None) + newline_chars=None) with pytest.raises(CommandFailure): userdel_cmd() @@ -37,7 +37,7 @@ def test_userdel_raises_command_error(buffer_connection, command_output_and_expe def test_userdel_raises_command_error_with_help(buffer_connection, command_output_and_expected_result_help): command_output, expected_result = command_output_and_expected_result_help buffer_connection.remote_inject_response([command_output]) - userdel_cmd = Userdel(connection=buffer_connection.moler_connection, options='-f', prompt=None, new_line_chars=None) + userdel_cmd = Userdel(connection=buffer_connection.moler_connection, options='-f', prompt=None, newline_chars=None) with pytest.raises(CommandFailure): userdel_cmd()