diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-03 13:54:55 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-03 13:54:55 +0200 |
commit | 98e14d27dee4e8e0619abd479583aac472a5fc08 (patch) | |
tree | f49f198dbb8aec331af9b5a62efe20813995ab06 /python/vyos | |
parent | c25a04907f3088aa29c7ffdb7c338fa169d891f4 (diff) | |
download | vyos-1x-98e14d27dee4e8e0619abd479583aac472a5fc08.tar.gz vyos-1x-98e14d27dee4e8e0619abd479583aac472a5fc08.zip |
Python/ifconfig: T1557: adjust debug message format #2
Diffstat (limited to 'python/vyos')
-rw-r--r-- | python/vyos/ifconfig.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 74b90d0c4..5247ac3d7 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -84,7 +84,7 @@ class Interface: def _debug_msg(self, msg): if self._debug: - print('DEBUG/{}: {}'.format(self._ifname, msg)) + print('DEBUG/{:<6} {}'.format(self._ifname, msg)) def remove(self): @@ -109,7 +109,7 @@ class Interface: def _cmd(self, command): - self._debug_msg(command) + self._debug_msg("{:<6} '{}'".format('cmd', command)) process = subprocess.Popen(command,stdout=subprocess.PIPE, shell=True) proc_stdout = process.communicate()[0].strip() @@ -126,7 +126,7 @@ class Interface: with open(filename, 'r') as f: value = f.read().rstrip('\n') - self._debug_msg("read '{}' < '{}'".format(value, filename)) + self._debug_msg("{:<6} '{}' < '{}'".format('read', value, filename)) return value @@ -134,7 +134,7 @@ class Interface: """ Provide a single primitive w/ error checking for writing to sysfs. """ - self._debug_msg("write '{}' > '{}'".format(value, filename)) + self._debug_msg("{:<6} '{}' > '{}'".format('write', value, filename)) with open(filename, 'w') as f: f.write(str(value)) @@ -506,7 +506,7 @@ class Interface: ['192.0.2.1/24', '2001:db8::ffff/64'] """ if not is_intf_addr_assigned(self._ifname, addr): - cmd = 'sudo ip addr add "{}" dev "{}"'.format(addr, self._ifname) + cmd = 'ip addr add "{}" dev "{}"'.format(addr, self._ifname) self._cmd(cmd) |