fedimg: Add the partial_upload script for fedimg
Signed-off-by: Sayan Chowdhury <sayan.chowdhury2012@gmail.com>
This commit is contained in:
parent
5a61fd46fc
commit
ad936dfbab
2 changed files with 70 additions and 0 deletions
62
roles/fedimg/files/partial_upload.py
Normal file
62
roles/fedimg/files/partial_upload.py
Normal file
|
@ -0,0 +1,62 @@
|
|||
#!/bin/env python
|
||||
# -*- coding: utf8 -*-
|
||||
""" Triggers a partial upload process with the specified raw.xz URL. """
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import logging.config
|
||||
|
||||
import fedmsg.config
|
||||
|
||||
from fedimg.config import AWS_ACCESS_ID
|
||||
from fedimg.config import AWS_SECRET_KEY
|
||||
from fedimg.services.ec2.ec2initiate import main as ec2main
|
||||
|
||||
logging.config.dictConfig(fedmsg.config.load_config()['logging'])
|
||||
log = logging.getLogger('fedmsg')
|
||||
|
||||
|
||||
def get_args():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Trigger a partial upload based on the arguments")
|
||||
parser.add_argument(
|
||||
"-u", "--url", type=str, help=".raw.xz URL", required=True)
|
||||
parser.add_argument(
|
||||
"-c", "--compose-id", type=str, help="compose id of the .raw.xz file",
|
||||
required=True)
|
||||
parser.add_argument(
|
||||
"-p", "--push-notifications",
|
||||
help="Bool to check if we need to push fedmsg notifications",
|
||||
action="store_true", required=False)
|
||||
parser.add_argument(
|
||||
"-v", "--volume", help="volume type for the image", required=False)
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
return (
|
||||
args.url,
|
||||
args.compose_id,
|
||||
args.push_notifications,
|
||||
args.volume
|
||||
)
|
||||
|
||||
|
||||
def main():
|
||||
url, compose_id, push_notifications, volume = get_args()
|
||||
|
||||
if volume is not None:
|
||||
volume = [volume]
|
||||
|
||||
ec2main(
|
||||
image_urls=url,
|
||||
access_id=AWS_ACCESS_ID,
|
||||
secret_key=AWS_SECRET_KEY,
|
||||
regions=None,
|
||||
volume_types=volume,
|
||||
push_notifications=push_notifications,
|
||||
compose_id=compose_id
|
||||
)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -28,6 +28,14 @@
|
|||
tags:
|
||||
- fedimg
|
||||
|
||||
- name: copy manual partial trigger script
|
||||
copy: >
|
||||
src=partial_upload.py
|
||||
dest=/usr/local/bin/partial_upload.py
|
||||
mode=0755
|
||||
tags:
|
||||
- fedimg
|
||||
|
||||
- name: copy base configuration
|
||||
template: >
|
||||
src=fedimg-conf.toml dest=/etc/fedimg/fedimg-conf.toml
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue