-
Notifications
You must be signed in to change notification settings - Fork 0
code review #2
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
base: master
Are you sure you want to change the base?
code review #2
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import os | ||
import subprocess | ||
import json | ||
import argparse | ||
|
||
|
||
|
||
def main(): | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('--stream', dest='stream', type=str, help='Fedora stream', required=True) | ||
parser.add_argument('--arch', dest='arch', type=str, help='Architecture', default='x86_64') | ||
args = parser.parse_args() | ||
|
||
builds = getBuildsForStream(args.stream, args.arch) | ||
for build in builds: | ||
print("The build is "+build) | ||
dustymabe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
buildFetch(args.stream, build, args.arch) | ||
meta = open('builds/'+build+'/'+args.arch+'/meta.json') | ||
data = json.load(meta) | ||
|
||
# Delete this when actually running. Just here while I make this script | ||
# data ={"amis":[{ | ||
# "name": "us-east-1", | ||
# "hvm": "ami-0016d5df3041499f9", | ||
# "snapshot": "snap-0c1ca4850fcd5e573" | ||
# }]} | ||
amis = data['amis'] | ||
for ami in amis: | ||
|
||
UpdateTagCmd = 'aws ec2 create-tags --resource ' + ami['hvm'] + ' --tags '+ 'Key="FedoraUser",Value="coreos"' + ' --region=' + ami['name'] | ||
dustymabe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
try: | ||
subprocess.call(['/bin/bash', '-i', '-c', UpdateTagCmd]) | ||
except subprocess.CalledProcessError as e: | ||
return(e.output) | ||
dustymabe marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
return | ||
|
||
def getBuildsForStream(stream, arch): | ||
buildFetch = 'cosa buildfetch --stream='+ stream + ' --arch='+ arch | ||
try: | ||
subprocess.call(['/bin/bash', '-i', '-c', buildFetch]) | ||
except subprocess.CalledProcessError as e: | ||
return(e.output) | ||
|
||
f = open('builds/builds.json') | ||
data = json.load(f) | ||
builds = [] | ||
|
||
for i in data['builds']: | ||
builds.append(i['id']) | ||
return builds | ||
|
||
def buildFetch(stream, build, arch): | ||
buildFetchCmd = 'cosa buildfetch --stream='+ stream + '--build=' + build + '--arch=' + arch | ||
try: | ||
subprocess.call(['/bin/bash', '-i', '-c', buildFetchCmd]) | ||
except subprocess.CalledProcessError as e: | ||
return(e.output) | ||
|
||
if __name__ == '__main__': | ||
main() |
Uh oh!
There was an error while loading. Please reload this page.