summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2021-12-14 02:37:53 +0300
committerPatrick Williams <patrick@stwcx.xyz>2021-12-14 02:38:16 +0300
commit1349014d9059af637f66ac82be05e021c02b9c2b (patch)
tree46c4ea05743e0d41627dff8bc5764236110b0ab9 /scripts
parentcaa11f7a5dfe2a47b686362468decaeff2339be2 (diff)
downloadbmcweb-1349014d9059af637f66ac82be05e021c02b9c2b.tar.xz
hostlogger_test.py: reformat with black
pycodestyle was throwing errors in CI. Run 'black' to reformat the script. Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I5138493c1e0641f0e927d0cc463ff6023f54454a
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/hostlogger_test.py28
1 files changed, 16 insertions, 12 deletions
diff --git a/scripts/hostlogger_test.py b/scripts/hostlogger_test.py
index 6080b34d46..415c584dc1 100755
--- a/scripts/hostlogger_test.py
+++ b/scripts/hostlogger_test.py
@@ -15,7 +15,9 @@ from requests.auth import HTTPBasicAuth
parser = argparse.ArgumentParser()
parser.add_argument("--host", help="Host to connect to", required=True)
parser.add_argument("--cert", help="File path to cert", required=True)
-parser.add_argument("--username", help="Username to connect with", default="root")
+parser.add_argument(
+ "--username", help="Username to connect with", default="root"
+)
parser.add_argument("--password", help="Password to use", default="0penBmc")
args = parser.parse_args()
@@ -33,10 +35,12 @@ def requests_get(url):
data = resp.json()
if resp.status_code != requests.codes.ok:
- print "There occurs error when get request, status_code = " + str(
- resp.status_code
- ) + "\n"
- print json.dumps(data, indent=4, sort_keys=True)
+ print(
+ "There occurs error when get request, status_code = "
+ + str(resp.status_code)
+ + "\n"
+ )
+ print(json.dumps(data, indent=4, sort_keys=True))
pass
return data
@@ -58,9 +62,8 @@ def label_parser(url, label):
def main():
logging.captureWarnings(True)
totalEntryUri = (
- "https://{}/redfish/v1/Systems/system/LogServices/HostLogger/Entries/".format(
- args.host
- )
+ "https://{}/redfish/v1/Systems/system/"
+ + "LogServices/HostLogger/Entries/".format(args.host)
)
id = 0
entryCount = 0
@@ -69,8 +72,8 @@ def main():
while 1:
entryCount = label_parser(totalEntryUri, "Members@odata.count")
if id == entryCount:
- # entryCount equals to ID means there has no change during the interval,
- # sleep 5 seconds for next search.
+ # entryCount equals to ID means there has no change during the
+ # interval, sleep 5 seconds for next search.
time.sleep(5)
elif id < entryCount:
# print new entries which created in this interval.
@@ -80,8 +83,9 @@ def main():
"HostLogger/Entries/{}".format(args.host, i)
)
message = label_parser(singleEntryUri, "Message")
- # need to present all special characters, so use "repr" function
- print (repr(message))
+ # need to present all special characters, so use "repr"
+ # function
+ print(repr(message))
id = entryCount