Skip to content

Commit

Permalink
utils: T7095: remove unused auth parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
xeluior committed Jan 27, 2025
1 parent d50cdfe commit cb546cb
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions python/vyos/utils/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,17 @@
from subprocess import DEVNULL


def get_wrapper(vrf, netns, auth):
def get_wrapper(vrf, netns):
wrapper = ''
if vrf:
wrapper = f'ip vrf exec {vrf} '
elif netns:
wrapper = f'ip netns exec {netns} '
if auth:
wrapper = f'{auth} {wrapper}'
return wrapper


def popen(command, flag='', shell=None, input=None, timeout=None, env=None,
stdout=PIPE, stderr=PIPE, decode='utf-8', auth='', vrf=None,
netns=None):
stdout=PIPE, stderr=PIPE, decode='utf-8', vrf=None, netns=None):
"""
popen is a wrapper helper around subprocess.Popen
with it default setting it will return a tuple (out, err)
Expand Down Expand Up @@ -82,7 +79,7 @@ def popen(command, flag='', shell=None, input=None, timeout=None, env=None,
'Permission denied: cannot execute commands in VRF and netns contexts as an unprivileged user'
)

wrapper = get_wrapper(vrf, netns, auth)
wrapper = get_wrapper(vrf, netns)
command = f'{wrapper} {command}'

cmd_msg = f"cmd '{command}'"
Expand Down Expand Up @@ -155,7 +152,7 @@ def run(command, flag='', shell=None, input=None, timeout=None, env=None,

def cmd(command, flag='', shell=None, input=None, timeout=None, env=None,
stdout=PIPE, stderr=PIPE, decode='utf-8', raising=None, message='',
expect=[0], auth='', vrf=None, netns=None):
expect=[0], vrf=None, netns=None):
"""
A wrapper around popen, which returns the stdout and
will raise the error code of a command
Expand All @@ -171,12 +168,11 @@ def cmd(command, flag='', shell=None, input=None, timeout=None, env=None,
input=input, timeout=timeout,
env=env, shell=shell,
decode=decode,
auth=auth,
vrf=vrf,
netns=netns,
)
if code not in expect:
wrapper = get_wrapper(vrf, netns, auth='')
wrapper = get_wrapper(vrf, netns)
command = f'{wrapper} {command}'
feedback = message + '\n' if message else ''
feedback += f'failed to run command: {command}\n'
Expand Down

0 comments on commit cb546cb

Please sign in to comment.