distgit: Update the script to the latest from puppet
This commit is contained in:
parent
cd3eb3c4e5
commit
f591a084dd
1 changed files with 26 additions and 13 deletions
|
@ -73,16 +73,17 @@ def normalize_branch(collection_cache, branch):
|
||||||
|
|
||||||
# process_package :: PkgDB -> String -> String -> IO Bool
|
# process_package :: PkgDB -> String -> String -> IO Bool
|
||||||
def process_package(pkgdb, pkg, src, dest):
|
def process_package(pkgdb, pkg, src, dest):
|
||||||
|
print "*** Processing package: " + pkg
|
||||||
|
|
||||||
data = pkgdb.get_package(pkg)
|
data = pkgdb.get_package(pkg)
|
||||||
pkg_list = data['packages']
|
pkg_list = data['packages']
|
||||||
|
|
||||||
maybe_source = filter(lambda y: y['collection']['branchname'] == src,
|
maybe_source = [branch for branch in pkg_list if branch['collection']['branchname'] == src]
|
||||||
pkg_list)
|
maybe_dest = [branch for branch in pkg_list if branch['collection']['branchname'] == dest]
|
||||||
maybe_dest = filter(lambda y: y['collection']['branchname'] == dest,
|
|
||||||
pkg_list)
|
|
||||||
if len(maybe_source) == 0:
|
if len(maybe_source) == 0:
|
||||||
print "Source branch `" + src + "' not found. Please "\
|
print "Source branch `" + src + "' not found. Please "\
|
||||||
"branch" + pkg + "manually."
|
"branch " + pkg + " manually."
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if len(maybe_dest) != 0:
|
if len(maybe_dest) != 0:
|
||||||
|
@ -90,10 +91,22 @@ def process_package(pkgdb, pkg, src, dest):
|
||||||
" Not overwriting branch."
|
" Not overwriting branch."
|
||||||
return False
|
return False
|
||||||
|
|
||||||
acls = filter(lambda y: y['fas_name'] != 'group::provenpackager',
|
if 'acls' not in maybe_source[0].keys():
|
||||||
maybe_source[0]['acls'])
|
print "No 'acls' key given to us by pkgdb. Cloning ACLs from a "\
|
||||||
map(lambda acl: pkgdb.update_acl(pkg, dest, acl['acl'], acl['status'],
|
"branch that has no ACLs due to retirement/orphan?"
|
||||||
acl['fas_name']), acls)
|
return False
|
||||||
|
|
||||||
|
acls = [
|
||||||
|
acl
|
||||||
|
for acl in maybe_source[0]['acls']
|
||||||
|
if acl['fas_name'] != 'group::provenpackager'
|
||||||
|
]
|
||||||
|
|
||||||
|
for acl in acls:
|
||||||
|
pkgdb.update_acl(pkg, dest, acl['acl'], acl['status'], acl['fas_name'])
|
||||||
|
|
||||||
|
pkgdb.update_package_poc(pkg, dest, maybe_source[0]['point_of_contact'])
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# main :: [String] -> IO Unit
|
# main :: [String] -> IO Unit
|
||||||
|
@ -132,9 +145,9 @@ def main(args):
|
||||||
NEW_EPEL_SOURCE_BRANCH,
|
NEW_EPEL_SOURCE_BRANCH,
|
||||||
"epel" + NEW_EPEL_VERSION,
|
"epel" + NEW_EPEL_VERSION,
|
||||||
key])
|
key])
|
||||||
print "[" + key + "] Success"
|
print "[" + key + "] \033[1m\033[32mSUCCESS\033[0m"
|
||||||
else:
|
else:
|
||||||
print "[" + key + "] Error"
|
print "[" + key + "] \033[1m\033[31mERROR\033[0m"
|
||||||
print "Done."
|
print "Done."
|
||||||
else:
|
else:
|
||||||
src_branchname = normalize_branch(collection_cache, args[0])
|
src_branchname = normalize_branch(collection_cache, args[0])
|
||||||
|
@ -144,9 +157,9 @@ def main(args):
|
||||||
"name, " + src_branchname + " -> " + dest_branchname
|
"name, " + src_branchname + " -> " + dest_branchname
|
||||||
for pkg in args[2:]:
|
for pkg in args[2:]:
|
||||||
if process_package(pkgdb, key, src_branchname, dest_branchname):
|
if process_package(pkgdb, key, src_branchname, dest_branchname):
|
||||||
print "[" + key + "] Success"
|
print "[" + key + "] \033[1m\033[32mSUCCESS\033[0m"
|
||||||
else:
|
else:
|
||||||
print "[" + key + "] Error"
|
print "[" + key + "] \033[1m\033[31mERROR\033[0m"
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main(sys.argv[1:])
|
main(sys.argv[1:])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue