Skip to content

Commit

Permalink
ovis-roll-over.py conversion to python3
Browse files Browse the repository at this point in the history
  • Loading branch information
jennfshr authored and tom95858 committed Oct 28, 2024
1 parent 41ea6d7 commit b61c4e4
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ldms/scripts/ovis-roll-over.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python2
#!/usr/bin/env python3
from __future__ import print_function
import shlex
from subprocess import Popen, PIPE
Expand Down Expand Up @@ -38,7 +38,7 @@

# Check if auth file exists
if not os.path.isfile(args.cfg_auth_file):
print("The secret file specified, '{0}', does not exist.".format(args.cfg_auth_file))
print(f"The secret file specified, {args.cfg_auth_file}, does not exist.")
sys.exit(1)

# Tell the running daemon to start storing data to a new path
Expand All @@ -57,9 +57,9 @@
(out, err) = p.communicate(input="config name=store_sos path={0}\nquit".format(next_path))
if out is not None and len(out) > 0:
print("Failure attempting communicate with the ldmsd daemon:")
print(out)
print(f"{out}")
sys.exit(2)
print("LDMSD now storing into {0}".format(next_path))
print(f"LDMSD now storing into {next_path}")

# If a yesterday link exists, destroy that tree and link yesterday to today
yesterlink = args.src_path + "/" + args.prev_link
Expand All @@ -74,7 +74,7 @@
except Exception as e:
print("Failed to remove old data.")
print("The error is:")
print(e)
print(f"{e}")

#
# Update the 'Today' link to point to the next_path
Expand All @@ -87,12 +87,12 @@
os.symlink(next_path, today)
os.symlink(yesterpath, yesterlink)

print("{0} now pointing to {1}".format(today, next_path))
print("{0} now pointing to {1}".format(yesterlink, yesterpath))
print(f"{today} now pointing to {next_path}")
print(f"{yesterlink} now pointing to {yesterpath}")

# Move the contents of the previous directory to archive storage
# copy the container files to the destination directory
print("copying {0} to {1}...".format(yesterpath, args.dst_path), end='')
print(f"copying {yesterpath} to {args.dst_path}... ")
shutil.copytree(yesterpath, args.dst_path+"/"+os.path.basename(yesterpath))
print("done")
sys.exit(0)

0 comments on commit b61c4e4

Please sign in to comment.