Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python fixes #64

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/MilkCheck/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self, options):

# Read config files
if os.access(self.CONFIG_PATH, os.F_OK):
data = yaml.load(open(self.CONFIG_PATH))
data = yaml.load(open(self.CONFIG_PATH), yaml.FullLoader)
# Parse read content
self._check_data(data)
else:
Expand Down
14 changes: 8 additions & 6 deletions tests/MilkCheckTests/UITests/CliTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ def write(self, line):
# We modify the output to match those from OpenSSH 5.x
line = re.sub('ssh: (\w+): (Name or service not known)',
'ssh: Could not resolve hostname \\1: \\2', line)
line = re.sub('ssh: (\w+): (Temporary failure in name resolution)',
'ssh: Could not resolve hostname \\1: \\2', line)

# SSH output is different with OpenSSH (>= 6.6)
# The output gives a lower hostname, we convert it to lower case
# by default
def lower_hostname(match):
return "ssh: Could not resolve hostname %s:" % match.group(1).lower()
line = re.sub('ssh: Could not resolve hostname (\w+):',
return "ssh: Could not resolve hostname %s" % match.group(1).lower()
line = re.sub('ssh: Could not resolve hostname (\w+):.*',
lower_hostname, line)

# Traceback output doesn't need line number and source location
Expand Down Expand Up @@ -246,7 +248,7 @@ def test_execute_std_verbosity(self):
self._output_check(['S3', 'start'], RC_ERROR,
"""G1.I1 - I am the service I1 [ OK ]
start G1.I2 ran in 0.00 s
> BADNODE: ssh: Could not resolve hostname badnode: Name or service not known
> BADNODE: ssh: Could not resolve hostname badnode
> BADNODE exited with 255
G1.I2 - I am the service I2 [ ERROR ]
G1 [DEP_ERROR]
Expand All @@ -262,7 +264,7 @@ def test_execute_verbosity_1(self):
start G1.I2 on BADNODE,HOSTNAME
> /bin/true
start G1.I2 ran in 0.00 s
> BADNODE: ssh: Could not resolve hostname badnode: Name or service not known
> BADNODE: ssh: Could not resolve hostname badnode
> HOSTNAME exited with 0
> BADNODE exited with 255
G1.I2 - I am the service I2 [ ERROR ]
Expand All @@ -282,7 +284,7 @@ def test_execute_verbosity_2(self):
start G1.I2 on BADNODE,HOSTNAME
> /bin/true
start G1.I2 ran in 0.00 s
> BADNODE: ssh: Could not resolve hostname badnode: Name or service not known
> BADNODE: ssh: Could not resolve hostname badnode
> HOSTNAME exited with 0
> BADNODE exited with 255
G1.I2 - I am the service I2 [ ERROR ]
Expand All @@ -302,7 +304,7 @@ def test_execute_debug(self):
start G1.I2 on BADNODE,HOSTNAME
> /bin/true
start G1.I2 ran in 0.00 s
> BADNODE: ssh: Could not resolve hostname badnode: Name or service not known
> BADNODE: ssh: Could not resolve hostname badnode
> HOSTNAME exited with 0
> BADNODE exited with 255
G1.I2 - I am the service I2 [ ERROR ]
Expand Down