failure = False
try:
trans = yaml.load(sourcecontent)
- except yaml.YAMLError, exc:
+ except yaml.YAMLError as exc:
# Someone fucked it up
print "ERROR: %s" % (exc)
return None
try:
fcntl.lockf(lock_fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
return lock_fd
- except OSError, e:
+ except OSError as e:
if errno.errorcode[e.errno] == 'EACCES' or errno.errorcode[e.errno] == 'EEXIST':
print "Unable to get lock for %s (try %d of 10)" % \
(file, retry+1)
"""
- trans_file = Cnf["Dinstall::Reject::ReleaseTransitions"]
+ trans_file = Cnf["Dinstall::ReleaseTransitions"]
trans_temp = trans_file + ".tmp"
trans_lock = lock_file(trans_file)
"""
(fd, path) = tempfile.mkstemp("", "transitions", Cnf["Dir::TempPath"])
- os.chmod(path, 0644)
+ os.chmod(path, 0o644)
f = open(path, "w")
yaml.dump(transitions, f, default_flow_style=False)
return path
def edit_transitions():
""" Edit the defined transitions. """
- trans_file = Cnf["Dinstall::Reject::ReleaseTransitions"]
+ trans_file = Cnf["Dinstall::ReleaseTransitions"]
edit_file = temp_transitions_file(load_transitions(trans_file))
editor = os.environ.get("EDITOR", "vi")
init()
# Check if there is a file defined (and existant)
- transpath = Cnf.get("Dinstall::Reject::ReleaseTransitions", "")
+ transpath = Cnf.get("Dinstall::ReleaseTransitions", "")
if transpath == "":
- utils.warn("Dinstall::Reject::ReleaseTransitions not defined")
+ utils.warn("Dinstall::ReleaseTransitions not defined")
sys.exit(1)
if not os.path.exists(transpath):
utils.warn("ReleaseTransitions file, %s, not found." %
- (Cnf["Dinstall::Reject::ReleaseTransitions"]))
+ (Cnf["Dinstall::ReleaseTransitions"]))
sys.exit(1)
# Also check if our temp directory is defined and existant
temppath = Cnf.get("Dir::TempPath", "")
if Options["import"]:
try:
write_transitions_from_file(Options["import"])
- except TransitionsError, m:
+ except TransitionsError as m:
print m
sys.exit(2)
sys.exit(0)