Skip to content

Commit

Permalink
Fix E0606 errors reported by pylint
Browse files Browse the repository at this point in the history
E0606 -> possibly-used-before-assignement

Note that in case of checktargetrepos actor we are introducing
  https://red.ht/upgrading-rhel9-to-rhel10-main-official-doc
for IPU 9 -> 10. However, this shortened URL must be defined yet later.
  • Loading branch information
pirat89 committed May 14, 2024
1 parent d7ad5d7 commit 02d7b68
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ def process():
ipu_doc_url = 'https://red.ht/upgrading-rhel7-to-rhel8-main-official-doc'
elif target_major_version == '9':
ipu_doc_url = 'https://red.ht/upgrading-rhel8-to-rhel9-main-official-doc'
else:
ipu_doc_url = 'https://red.ht/upgrading-rhel9-to-rhel10-main-official-doc'


rhui_info = next(api.consume(RHUIInfo), None)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ def mock_context_path_exists(path):

module_class = None
copy_fn = None
dst_path = None
if kind == 'dracut':
module_class = DracutModule
copy_fn = upgradeinitramfsgenerator.copy_dracut_modules
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ def mocked_os_listdir(path):

produced_custom_repo_msgs = []
target_iso_msg = None
target_iso = None
for produced_msg in produced_msgs:
if isinstance(produced_msg, CustomTargetRepository):
produced_custom_repo_msgs.append(produced_msg)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ def __call__(self, args, split=True):
"port -a -t http_port_t -p udp 81",
"fcontext -a -f a -t httpd_sys_content_t '/web(/.*)?'",
"fcontext -a -f a -t cgdcbxd_exec_t '/ganesha(/.*)?'"]
else:
assert False, 'run_mocked: Called unexpected cmd not covered by test: {}'.format(self.args)

return {'stdout': stdout}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __call__(self, args, split=True):
self.removed_modules.add(self.args[idx + 1])
else:
self.non_semodule_calls += 1
stdout = []

return {'stdout': stdout}

Expand Down
3 changes: 3 additions & 0 deletions repos/system_upgrade/common/libraries/tests/test_grub.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self, raise_err=False, boot_on_raid=False):
def __call__(self, args, encoding=None):
self.called += 1
self.args = args
stdout = ''
if self.raise_err:
raise_call_error(args)

Expand All @@ -50,6 +51,8 @@ def __call__(self, args, encoding=None):
stdout = BOOT_DEVICE
elif self.args[:-1] == ['lsblk', '-spnlo', 'name']:
stdout = self.args[-1][:-1]
else:
assert False, 'RunMockedError: Called unexpected cmd not covered by test: {}'.format(self.args)

return {'stdout': stdout}

Expand Down
2 changes: 2 additions & 0 deletions repos/system_upgrade/common/libraries/tests/test_mdraid.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def __call__(self, args, encoding=None):
stdout = 'ARRAY /dev/md0 level=raid1 num-devices=2 metadata=1.2 name=localhost.localdomain:0 UUID=c4acea6e:d56e1598:91822e3f:fb26832c\n devices=/dev/sda1,/dev/sdb1' # noqa: E501; pylint: disable=line-too-long
elif self.args == ['mdadm', '--detail', '--verbose', '--brief', NOT_MD_DEVICE]:
stdout = 'mdadm: /dev/sda does not appear to be an md device'
else:
assert False, 'RunMockedError: Called unexpected cmd not covered by test: {}'.format(self.args)

return {'stdout': stdout}

Expand Down

0 comments on commit 02d7b68

Please sign in to comment.