Skip to content

Commit

Permalink
Fix: pylint: fix string literal problems
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasyang2022 committed Nov 4, 2024
1 parent fe7f066 commit f6905eb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 9 deletions.
4 changes: 2 additions & 2 deletions crmsh/corosync.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def find_configured_ip(ip_list):
If so, raise IPAlreadyConfiguredError
"""
data = utils.read_from_file(conf())
corosync_iplist = re.findall('ring[0-7]_addr:\s*(.*?)\n', data)
corosync_iplist = re.findall('ring[0-7]_addr:\\s*(.*?)\n', data)

# all_possible_ip is a ip set to check whether one of them already configured
all_possible_ip = set(ip_list)
Expand Down Expand Up @@ -807,7 +807,7 @@ def remove_link(self, linknumber: int) -> dict:
if linknumber >= KNET_LINK_NUM_LIMIT or links[linknumber] is None:
raise ValueError(f'Link {linknumber} does not exist.')
if sum(1 if link is not None else 0 for link in links) <= 1:
raise ValueError(f'Cannot remove the last link.')
raise ValueError('Cannot remove the last link.')
nodes = self._config['nodelist']['node']
assert isinstance(nodes, list)
for node in nodes:
Expand Down
6 changes: 3 additions & 3 deletions crmsh/report/collect.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,13 +442,13 @@ def collect_qdevice_info(context: core.Context) -> None:
"""
Collect quorum/qdevice/qnetd information
"""
out_string = f"##### Quorum status #####\n"
out_string = "##### Quorum status #####\n"
out_string += corosync.query_quorum_status() + "\n"

if ServiceManager().service_is_active("corosync-qdevice.service"):
out_string += f"\n##### Qdevice status #####\n"
out_string += "\n##### Qdevice status #####\n"
out_string += corosync.query_qdevice_status() + "\n"
out_string += f"\n##### Qnetd status #####\n"
out_string += "\n##### Qnetd status #####\n"
out_string += corosync.query_qnetd_status() + "\n"

_file = os.path.join(context.work_dir, constants.QDEVICE_F)
Expand Down
2 changes: 1 addition & 1 deletion crmsh/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -2044,7 +2044,7 @@ def _process_local(self, cmdline, is_json_output):
Handle an action that executes locally
"""
if self.sudo_pass:
input_s = u'sudo: %s\n' % (self.sudo_pass)
input_s = 'sudo: %s\n' % (self.sudo_pass)
else:
input_s = None
if self.dry_run:
Expand Down
2 changes: 0 additions & 2 deletions crmsh/sh.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,6 @@ def subprocess_run_without_input(self, host: typing.Optional[str], user: typing.
host,
user,
'--preserve-env=SSH_AUTH_SOCK' if self.forward_ssh_agent else '',
constants.SSH_OPTION,
),
input=cmd.encode('utf-8'),
start_new_session=True,
Expand Down Expand Up @@ -418,7 +417,6 @@ def ssh_to_localhost(self, user: typing.Optional[str], cmd: str, **kwargs):
host,
user,
'--preserve-env=SSH_AUTH_SOCK' if self.forward_ssh_agent else '',
constants.SSH_OPTION,
),
input=cmd.encode('utf-8'),
**kwargs,
Expand Down
2 changes: 1 addition & 1 deletion crmsh/ui_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ def flatten(script):
return script

def order_rep(dumper, data):
return dumper.represent_mapping(u'tag:yaml.org,2002:map', list(data.items()), flow_style=False)
return dumper.represent_mapping('tag:yaml.org,2002:map', list(data.items()), flow_style=False)

def scriptsorter(item):
order = ["version", "name", "category", "shortdesc", "longdesc", "include", "parameters", "steps", "actions"]
Expand Down

0 comments on commit f6905eb

Please sign in to comment.