From 3de50a96ef98b1c01609c257ceb083086d4dab90 Mon Sep 17 00:00:00 2001 From: Dennis Gilmore Date: Apr 20 2017 20:09:02 +0000 Subject: remove scripts we are definitely not using These scripts used to serve purposes. they are no longer used so lets just nuke them from orbit. Signed-off-by: Dennis Gilmore --- diff --git a/scripts/build-arm-images b/scripts/build-arm-images deleted file mode 100755 index e8b2bb3..0000000 --- a/scripts/build-arm-images +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2012 Red Hat Inc. -# SPDX-License-Identifier: GPL-2.0+ - -ARCHES="armv7hl" - -RELEASE=$1 -BUILD=$2 -VERSION=$3 -KSEXTRAARGS="-v F21" - -if [ "$VERSION" == "rawhide" ]; then -TARGET=rawhide -else -TARGET=f$VERSION-candidate -fi - -GITHASH=$(git rev-parse --short HEAD) - -SPINS="Minimal Workstation Server KDE LXDE Mate SoaS Xfce" -for spin in $SPINS -do - declare -l lspin - lspin=$spin - ksflatten $KSEXTRAARGS -c fedora-arm-$lspin.ks -o fedora-arm-$lspin-$GITHASH.ks >& /dev/null - for ARCH in $ARCHES - do - if [[ $ARCH == armv7hl ]] - then BASEARCH=armhfp - else BASEARCH=$ARCH - fi - koji spin-appliance --scratch --release $BUILD --nowait Fedora-$spin-$BASEARCH $RELEASE --repo=http://infrastructure.fedoraproject.org/pub/fedora/linux/development/$VERSION/$BASEARCH/os/ --repo=http://kojipkgs.fedoraproject.org/mash/bleed/$BASEARCH/ $TARGET $ARCH fedora-arm-$lspin-$GITHASH.ks - done -done - - diff --git a/scripts/build-cloud-images b/scripts/build-cloud-images deleted file mode 100755 index 055d556..0000000 --- a/scripts/build-cloud-images +++ /dev/null @@ -1,126 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2013-2015 Red Hat Inc. -# SPDX-License-Identifier: GPL-2.0+ - -#TODO: this needs some major refactoring - -RELEASE=$1 -BUILD=$2 -VERSION=$3 -COMPOSE=$4 -KSEXTRAARGS="-v F21" - -GITHASH=$(git rev-parse --short HEAD) - - declare -l lspin - lspin=$spin - -if [ "$VERSION" == "rawhide" ]; then -TARGET=rawhide -BRANCH=rawhide -else -TARGET=f$VERSION-candidate -BRANCH=branched -fi - -if [ "$COMPOSE" == "nightly" ]; then - url=http://kojipkgs.fedoraproject.org/mash/$BRANCH-$BUILD/$VERSION/\$arch/os/ - atomicurl=http://kojipkgs.fedoraproject.org/mash/atomic/$VERSION/ - REPOS="--repo=$url" -elif [ "$COMPOSE" == "updates" ]; then - url=http://kojipkgs.fedoraproject.org/pub/fedora/linux/releases/$VERSION/Cloud/\$arch/os/ - if [ "$VERSION" -gt "21" ]; then - # we moved where we put the cloud install tree in f22 - url=http://kojipkgs.fedoraproject.org/pub/alt/releases/$VERSION/Cloud/\$arch/os/ - fi - updatesurl=http://kojipkgs.fedoraproject.org/pub/fedora/linux/updates/$VERSION/\$arch/ - atomicurl=http://kojipkgs.fedoraproject.org/mash/atomic/$VERSION/ - REPOS="--repo=$url --repo=$updatesurl" - KSEXTRAARGS="-v F21" -else - url=http://compose-x86-01.phx2.fedoraproject.org/compose/$RELEASE$COMPOSE/$RELEASE/Cloud/\$arch/os/ - atomicurl=http://compose-x86-01.phx2.fedoraproject.org/compose/atomic/ - REPOS="--repo=$url --repo=https://kojipkgs.fedoraproject.org/mash/bleed/\$arch/" -fi - -for spin in Base -do - declare -l lspin - lspin=$spin - kickstart=fedora-cloud-$lspin-$GITHASH.ks - ksflatten $KSEXTRAARGS -c fedora-cloud-$lspin.ks -o $kickstart - echo "url --url=$url"|sed -e 's|$arch|$basearch|g' >> $kickstart - #koji image-build fedora-cloud-$spin $VERSION --distro Fedora-20 $TARGET --ksurl=git://git.fedorahosted.org/git/spin-kickstarts.git?#$GITHASH --kickstart=fedora-cloud-$lspin.ks $url x86_64 i386 --format=qcow2 --format=raw --release=$VERSION --scratch --repo=$url --nowait --disk-size=3 - koji image-build Fedora-Cloud-$spin $RELEASE --distro Fedora-20 $TARGET --kickstart=fedora-cloud-$lspin-$GITHASH.ks $url i386 x86_64 --format=qcow2 --format=raw-xz --release=$BUILD --scratch $REPOS --nowait --disk-size=3 -done - -for spin in Base-Vagrant -do - declare -l lspin - lspin=$spin - kickstart=fedora-cloud-$lspin-$GITHASH.ks - ksflatten $KSEXTRAARGS -c fedora-cloud-$lspin.ks -o $kickstart - echo "url --url=$url"|sed -e 's|$arch|$basearch|g' >> $kickstart - koji image-build Fedora-Cloud-$spin $RELEASE $TARGET $url x86_64 \ - $REPOS \ - --release=$BUILD \ - --distro Fedora-20 \ - --kickstart=fedora-cloud-$lspin-$GITHASH.ks \ - --format=vagrant-libvirt \ - --format=vagrant-virtualbox \ - --scratch \ - --nowait \ - --disk-size=40 -done - -set_ostree_kickstart() { - local ks=$1 - local url=$2 - sed -i -e "s|--url=[^ ]*|--url=\"${url}\"|g" ${ks} -} - -for spin in Atomic -do - declare -l lspin - lspin=$spin - kickstart=fedora-cloud-$lspin-$GITHASH.ks - ksflatten $KSEXTRAARGS -c fedora-cloud-$lspin.ks -o $kickstart - set_ostree_kickstart ${kickstart} ${atomicurl} - - #koji image-build fedora-cloud-$spin $VERSION --distro Fedora-20 $TARGET --ksurl=git://git.fedorahosted.org/git/spin-kickstarts.git?#$GITHASH --kickstart=fedora-cloud-$lspin.ks $url x86_64 i386 --format=qcow2 --format=raw --release=$VERSION --scratch --repo=$url --nowait --disk-size=3 - koji image-build Fedora-Cloud-$spin $RELEASE --distro Fedora-20 $TARGET --kickstart=fedora-cloud-$lspin-$GITHASH.ks $url x86_64 --format=qcow2 --format=raw-xz --release=$BUILD --scratch --repo=$url --nowait --disk-size=6 -done - -for spin in Atomic-Vagrant -do - declare -l lspin - lspin=$spin - kickstart=fedora-cloud-$lspin-$GITHASH.ks - ksflatten $KSEXTRAARGS -c fedora-cloud-$lspin.ks -o $kickstart - set_ostree_kickstart ${kickstart} ${atomicurl} - - koji image-build Fedora-Cloud-$spin $RELEASE $TARGET $url x86_64 \ - $REPOS \ - --release=$BUILD \ - --distro Fedora-20 \ - --kickstart=fedora-cloud-$lspin-$GITHASH.ks \ - --format=vagrant-virtualbox \ - --format=vagrant-libvirt \ - --ova-option vagrant_sync_directory=/home/vagrant/sync \ - --scratch \ - --nowait \ - --disk-size=40 -done - -# Docker images -for spin in Base -do - declare -l lspin - lspin=$spin - kickstart=fedora-docker-$lspin-$GITHASH.ks - ksflatten $KSEXTRAARGS -c fedora-docker-$lspin.ks -o $kickstart - echo "url --url=$url"|sed -e 's|$arch|$basearch|g' >> $kickstart - #koji image-build fedora-cloud-$spin $VERSION --distro Fedora-20 $TARGET --ksurl=git://git.fedorahosted.org/git/spin-kickstarts.git?#$GITHASH --kickstart=fedora-cloud-$lspin.ks $url x86_64 i386 --format=qcow2 --format=raw --release=$VERSION --scratch --repo=$url --nowait --disk-size=3 - koji image-build Fedora-Docker-$spin $RELEASE --distro Fedora-20 $TARGET --kickstart=fedora-docker-$lspin-$GITHASH.ks $url x86_64 armhfp --format=docker --release=$BUILD --scratch $REPOS --nowait --disk-size=3 -done diff --git a/scripts/cloud/fedora_ec2.py b/scripts/cloud/fedora_ec2.py deleted file mode 100755 index 863ac0a..0000000 --- a/scripts/cloud/fedora_ec2.py +++ /dev/null @@ -1,876 +0,0 @@ -#!/usr/bin/python -tt -# A library for accessing and working with EC2. -# Author: Jay Greguske -# Copyright (C) 2013 Red Hat Inc. -# SPDX-License-Identifier: GPL-2.0+ - -import boto.ec2 -import logging -import os -from socket import gethostname -import subprocess -import sys -import time - -# we assume all RH accounts have access to these -pvgrubs = { - 'public': { - 'part': { - 'sa-east-1': {'i386': 'aki-bc3ce3a1', 'x86_64': 'aki-cc3ce3d1'}, - 'us-east-1': {'i386': 'aki-407d9529', 'x86_64': 'aki-427d952b'}, - 'us-west-1': {'i386': 'aki-99a0f1dc', 'x86_64': 'aki-9ba0f1de'}, - 'us-west-2': {'i386': 'aki-c2e26ff2', 'x86_64': 'aki-98e26fa8'}, - 'eu-west-1': {'i386': 'aki-4deec439', 'x86_64': 'aki-4feec43b'}, - 'ap-southeast-1': {'i386': 'aki-13d5aa41', 'x86_64': 'aki-11d5aa43'}, - 'ap-southeast-2': {'i386': 'aki-9b8413a1', 'x86_64': 'aki-998413a3'}, - 'ap-northeast-1': {'i386': 'aki-d209a2d3', 'x86_64': 'aki-d409a2d5'}}} -} - -def get_pvgrub(public, disk, region, arch): - """ - Return the AKI ID that matches parameters given: - public - boolean; whether the image is public (True) or private - disk - boolean; whether a disk image (True) or partition image - region - ec2 region - arch - i386 or x86_64 - Throws an Fedora_EC2Error if no image matches. - """ - if public: - pub = 'public' - else: - pub = 'private' - if disk: - dis = 'disk' - else: - dis = 'part' - try: - return pvgrubs[pub][dis][region][arch] - except KeyError: - raise Fedora_EC2Error('No matching PVGrub found (%s)' % - ', '.join((pub, dis, region, arch))) - -# -# Classes -# - -class Fedora_EC2Error(Exception): - """Custom exception for this library""" - pass - -class EC2Cred(object): - """ - Encapsulate EC2 credentials in an object for simple access. They are drawn - from the usual environment variables EC2 tools expect. - """ - - def __init__(self): - creds = {} - for env_var in ('EC2_ACCOUNT', 'EC2_ACCESS_KEY', 'EC2_SECRET_KEY', 'EC2_CERT', 'EC2_PRIVATE_KEY'): - creds[env_var] = os.environ.get(env_var) - if None in creds.values(): - raise RuntimeError, 'Missing environment variable(s): %s' % \ - ', '.join([k for k in creds.keys() if creds[k] == None]) - self.account = creds['EC2_ACCOUNT'] - self.cert = creds['EC2_CERT'] - self.private = creds['EC2_PRIVATE_KEY'] - self.access = creds['EC2_ACCESS_KEY'] - self.secret = creds['EC2_SECRET_KEY'] - -class EC2Obj(object): - """ - An object that encapsulates useful information that is specific to Fedora's - EC2 infrastructure and environments. Provides many methods to interact - with EC2 in a standarized way. - """ - - # SSH key <-> region mappings for AWS accounts - keypath = os.path.expanduser('.') - keys = { - '125523088429': { # fedaws - 'sa-east-1': 'releng-sa-east-1', - 'us-east-1': 'releng-us-east', - 'us-west-1': 'releng-us-west', - 'us-west-2': 'releng-us-west-2', - 'eu-west-1': 'releng-eu-west', - 'ap-southeast-1': 'releng-ap-southeast', - 'ap-southeast-2': 'releng-ap-southeast-2', - 'ap-northeast-1': 'releng-ap-northeast'} - } - - _instances = 1 - _devs = {} - _devs.update([('/dev/sd' + chr(i), None) for i in range(104, 111)]) - - def __init__(self, region='US', cred=None, quiet=False, logfile=None, - debug=False, test=False): - """ - Constructor; useful options to the object are interpreted here. - EC2Objs are region specific and we want to support a script - instanciating multiple EC2Objs, so some identity management and cross- - object data is maintained as class variables. EC2Objs are NOT - serialized! - - cred: a valid EC2Cred object - quiet: Do not print to stdout - logfile: path to write the log for use of this object - debug: enable debug output - test: enable test mode. test mode only displays the command we would - run, and all methods return None - """ - # logging - format = logging.Formatter("[%(asctime)s %(name)s %(levelname)s]: %(message)s") - if logfile == None: - logfile = '%s.%s.log' % (__name__, EC2Obj._instances) - logname = os.path.basename(logfile) - if logname.endswith('.log'): - logname = logname[:-4] - logdir = os.path.dirname(logfile) - if logdir != '' and not os.path.exists(logdir): - os.makedirs(logdir) - self.logger = logging.getLogger(logname) - self.testmode = test - if self.testmode: - debug = True - if debug: - self.logger.setLevel(logging.DEBUG) - else: - self.logger.setLevel(logging.INFO) - file_handler = logging.FileHandler(logfile) - file_handler.setFormatter(format) - self.logger.addHandler(file_handler) - if not quiet: - stdout_handler = logging.StreamHandler(sys.stdout) - stdout_handler.setFormatter(format) - self.logger.addHandler(stdout_handler) - - # check environment - for tool in ('euca-run-instances', 'euca-describe-instances', - 'euca-create-volume', 'euca-attach-volume', - 'euca-detach-volume', 'euca-describe-volumes', - 'euca-create-snapshot', 'euca-describe-snapshots', - 'euca-register', 'euca-delete-snapshot', - 'euca-delete-volume', 'euca-terminate-instances', - 'euca-modify-image-attribute'): - try: - self.run_cmd('which %s' % tool) - except Fedora_EC2Error: - self.logger.warning('%s is missing!' % tool) - - # object initialization - if cred == None: - self.cred = EC2Cred() - else: - self.cred = cred - self.region = self.alias_region(region) - self.rurl = 'http://ec2.%s.amazonaws.com' % self.region - self.logger.debug('Region: %s' % self.region) - self.logger.debug('Credentials:\n Account: %s\n Cert: %s\n PK: %s' % - (self.cred.account, self.cred.cert, self.cred.private)) - self.def_zone = '%sb' % self.region - self.def_group = 'Basic' - self.id = EC2Obj._instances - self._att_devs = {} - self.logger.debug('Initialized EC2Obj #%s' % EC2Obj._instances) - EC2Obj._instances += 1 - - def alias_region(self, reg): - """ - EC2 tools are not consistent about region labels, so we try to be - friendly about that here. - """ - region = reg - if reg in ('US', 'us-east'): - region = 'us-east-1' - elif reg == 'us-west': - region = 'us-west-1' - elif reg in ('EU', 'eu-west'): - region = 'eu-west-1' - elif reg == 'ap-southeast': - region = 'ap-southeast-1' - elif reg == 'ap-northeast': - region = 'ap-northeast-1' - elif reg in ('sa-east-1', 'us-east-1', 'us-west-1', 'us-west-2', 'eu-west-1', 'ap-southeast-1', - 'ap-southeast-2', 'ap-northeast-1'): - # these are what we want, do nothing - pass - else: - self.logger.warn('Unrecognized region: %s' % region) - return region - - def ami_info(self, ami_id): - """ - Return a dictionary that describes an AMI: - id - the AMI id - source - the bucket/name of the AMI - owner - account number of the owner - status - AMI status, normally 'available' - visibility - 'public' or 'private' - product - products codes associated with it (devpay) - arch - i386 or x86_64 - type - type of image ('machine', 'kernel', 'ramdisk') - aki - the AKI ID - ari - the ARI ID (empty string for pvgrub) - snapid - snapshot id of of the EBS volume it was registered from - """ - info = {} - if not ami_id.startswith('ami-'): - raise Fedora_EC2Error('Only an AMI ID can be passed to this method') - output = self.run_cmd('euca-describe-images -U %s %s' % - (self.rurl, ami_id))[0] - if self.testmode: return None - lines = output.split('\n') - if len(lines) > 1: - bits = lines[1].split('\t') - if bits[0] == 'BLOCKDEVICEMAPPING': - info['snapid'] = bits[3] - attrs = ('id', 'source', 'owner', 'status', 'visibility', 'product', - 'arch', 'type', 'aki', 'ari') - bits = lines[0].split('\t') - for i in range(len(attrs)): - try: - info[attrs[i]] = bits[i+1] - except IndexError: - info[attrs[i]] = '' # ari is missing sometimes - self.logger.debug('Retrieved image info: %s' % info) - return info - - def deregister_ami(self, ami_id): - """De-Register an AMI. Returns the ID of the AMI""" - output = self.run_cmd('euca-deregister -U %s %s' % - (self.rurl, ami_id))[0] - if self.testmode: return None - id = output.split('\t')[1] - self.logger.info('De-Registered an AMI: %s' % id) - return id - - def start_ami(self, ami, aki=None, ari=None, wait=False, zone=None, - group=None, keypair=None, disk=True): - """ - Start the designated AMI. This function does not guarantee success. See - inst_info to verify an instance started successfully. - Optionally takes a few keyword arguments: - - wait: True if we should wait until the instance is running - - aki: the AKI id to start with. Setting it to 'pvgrub' will cause - us to boot with the appropriate pvgrub AKI ID. Setting it to - None will boot it with the default it was bundled with. - - ari: the ARI id to start with - - zone: the availability zone to start in - - group: the security group to start the instance in - - keypair: SSH key pair to log in with - Returns a dictionary describing the instance, see inst_info(). - """ - ami_info = self.ami_info(ami) - if zone == None: - zone = self.def_zone - if group == None: - group = self.def_group - if keypair == None: - keypair = self.keys[self.cred.account][self.region] - cmd = 'euca-run-instances -U %s -k %s -n 1 -z %s -g "%s" %s ' % (self.rurl, keypair, zone, group, ami) - if ari != None: - cmd += '--ramdisk %s ' % ari - if aki == 'pvgrub': - # technically it doesn't matter if we use the public or private AKI - cmd += '--kernel %s ' % get_pvgrub(True, disk, self.region, - ami_info['arch']) - elif aki != None: - cmd += '--kernel %s ' % aki - print ami_info['arch'] - if ami_info['arch'] == 'i386': - cmd += '-t m1.small ' - elif ami_info['arch'] == 'x86_64': - cmd += '-t m1.large ' - else: - self._log_error('Unsupported arch: %s' % ami_info['arch']) - if self.testmode: - self.run_cmd(cmd) - return None - lines = self.run_cmd(cmd)[0].splitlines() - inst_id = lines[1].split('\t')[1] - if wait: - info = self.wait_inst_status(inst_id, 'running') - else: - info = self.inst_info(inst_id) - self._att_devs[info['id']] = EC2Obj._devs.copy() - self.logger.info('Started an instance of %s: %s' % (ami, info['id'])) - return info - - def inst_info(self, id): - """ - Return information about an instance. Returns a dictionary: - id - The instance ID - ami - The AMI ID - group - the Security Group it booted with - account - the account number the instance belongs to - reservation - the reservation number for the resources - status - instance status (pending, running, terminated, etc) - keypair - the SSH keypair - index - type - the instance type string such as m1.large - zone - availability zone - aki - the AKI ID it is booting with - ari - the ARI ID it is booting with (empty string for pvgrubs) - time - the time the instance was started - url - the url/hostname of the instance - address - the IP address - """ - info = {} - output = self.run_cmd('euca-describe-instances -U %s %s' % - (self.rurl, id))[0] - if self.testmode: return None - lines = output.splitlines() - bits = lines[0].split('\t') - info['reservation'], info['account'], info['group'] = bits[1:] - bits = lines[1].split('\t') - attrs = ('id', 'ami', 'url', 'address', 'status', 'keypair', 'index', - 'vpc', 'type', 'time', 'zone', 'aki', 'ari') - for i in range(len(attrs)): - try: - info[attrs[i]] = bits[i+1] - except IndexError: - info[attrs[i]] = '' # ari is missing sometimes - self.logger.debug('Retrieved instance info: %s' % info) - return info - - def get_url(self, id): - """Return the URL address of a running instance""" - info = self.inst_info(id) - if self.testmode: return None - if info['url'] == '': - self.logger.warning('Sought URL for %s but it is not defined' % id) - return info['url'] - - def wait_inst_status(self, id, status, tries=0, interval=20): - """ - Wait until an instance has the desired status. Optional arguments - tries and interval set how many tries and how long to wait between - polls respectively. Will throw an error if the status is ever - terminated, unless that is the desired status. Setting tries to 0 means - to try forever. Returns a dictionary describing the instance, see - inst_info(). - """ - forever = False - if tries == 0: - forever = True - timer = 1 - while timer <= tries or forever: - current = self.inst_info(id) - if self.testmode: return None - if current['status'] == status: - return current - if current['status'] == 'terminated': - self._log_error('%s is in the terminated state!' % id) - self.logger.info('Try #%s: %s is not %s, sleeping %s seconds' % - (timer, id, status, interval)) - time.sleep(interval) - timer += 1 - self._log_error('Timeout exceeded for %s to be %s' % (id, status)) - - def _take_dev(self, inst_id, vol_id): - """ - Internal method to get the next available device name to use when - attaching an EBS volume to an instance. Throws an error if we have - run out, 10 is the max. - """ - if self._att_devs.get(inst_id) == None: - self._att_devs[inst_id] = EC2Obj._devs.copy() - try: - dev = [d for d in self._att_devs[inst_id].keys() - if self._att_devs[inst_id][d] == None].pop() - except IndexError: - self._log_error('No free device names left for %s' % inst_id) - self._att_devs[inst_id][dev] = vol_id - self.logger.debug('taking %s to attach %s to %s' % - (dev, vol_id, inst_id)) - return dev - - def _release_dev(self, inst_id, vol_id): - """ - Internal method to release a device name back into the pool when - detaching from an instance. Throws an error if the device is already - unattached, since this should never happen. - """ - if vol_id not in self._att_devs[inst_id].values(): - self._log_error('Device is not attached! (%s from %s)' % - (vol_id, inst_id)) - dev = [d for d in self._att_devs[inst_id].keys() - if self._att_devs[inst_id][d] == vol_id].pop() - self._att_devs[inst_id][dev] = None - self.logger.debug('releasing %s from %s for %s' % - (dev, inst_id, vol_id)) - return dev - - def create_vol(self, size, zone=None, wait=False, snap=None): - """ - Create an EBS volume of the given size in region/zone. If size == 0, - do not explicitly set a size; this may be useful with "snap", which - creates a volume from a snapshot ID. - - This function does not guarantee success, you should check with - vol_available() to ensure it was created successfully. If wait is set - to True, we will wait for the volume to be available before returning; - returns a dictionary describing the volume, see vol_info(). - """ - if zone == None: - zone = self.def_zone - cmd = 'euca-create-volume -z %s -U %s' % (zone, self.rurl) - if size > 0: - cmd += ' --size %s' % size - if snap != None: - cmd += ' --snapshot %s' % snap - output = self.run_cmd(cmd)[0] - if self.testmode: return None - id = output.split('\t')[1] - if wait: - info = self.wait_vol_status(id, 'available') - else: - info = self.vol_info(id) - self.logger.info('Created an EBS volume: %s' % info['id']) - return info - - def attach_vol(self, inst_id, vol_id, wait=False, dev=None): - """ - Attach an EBS volume to an AMI id in region. This is not an immediate - action, you should check the status of the volume (see vol_info) if - you wish to do something more with it after attaching. Setting wait to - True cause the method to wait until the volume is attached before - returning. Can can be used to manually set the device name, otherwise - one will be selected automatically. Returns a dictionary describing the - volume, see vol_info(). - """ - if dev == None: - dev = self._take_dev(inst_id, vol_id) - else: - if not dev.startswith('/dev/sd'): - self._log_error('Not a valid device name: %s' % dev) - self.run_cmd('euca-attach-volume -U %s %s -i %s -d %s' % - (self.rurl, vol_id, inst_id,dev)) - if self.testmode: return None - if wait: - info = self.wait_vol_status(vol_id, 'attached') - else: - info = self.vol_info(vol_id) - self.logger.info('attached %s to %s' % (vol_id, inst_id)) - return info - - def detach_vol(self, inst_id, vol_id, wait=False): - """ - Detach an EBS volume from an instance. Note that this action is not - immediate, you should check the status of the volume if you wish to do - something more with it after detaching (see vol_info). Setting wait to - True will make the method wait until the volume is detached before - returning. Returns a dictionary describing the volume, see vol_info(). - """ - self.run_cmd('euca-detach-volume -U %s %s -i %s' % - (self.rurl, vol_id, inst_id)) - if self.testmode: return None - if wait: - info = self.wait_vol_status(vol_id, 'available') - else: - info = self.vol_info(vol_id) - self._release_dev(inst_id, vol_id) - self.logger.info('Detached %s from %s' % (vol_id, inst_id)) - return info - - def vol_info(self, vol_id): - """ - Get status on a volume. Returns a dictionary with the following fields: - id - the volume ID - size - the size in gigabytes of the volume - snapshot - zone - availability zone - status - available, creating, ... - time - the time the volume was created - - If the volume is attached, additional fields will be available: - instance - the instance ID it is attached to - device - the device name it is exposed as - attach_status - status of the attachment - attach_time - when the volume was attached - """ - output = self.run_cmd("euca-describe-volumes -U %s %s" % - (self.rurl, vol_id))[0] - if self.testmode: return None - info = {} - lines = output.splitlines() - attrs = ('id', 'size', 'snapshot', 'zone', 'status', 'time') - bits = lines[0].split('\t') - for i in range(len(attrs)): - info[attrs[i]] = bits[i+1] - if len(lines) == 2: - bits = lines[1].split('\t') - attrs = ('instance', 'device', 'attach_time') - # euca2ools do not have this field :( - info['attach_status'] = 'attached' - for i in range(len(attrs)): - info[attrs[i]] = bits[i+2] - self.logger.debug('Retrieved volume info: %s' % info) - return info - - def wait_vol_status(self, vol_id, status, tries=0, interval=20): - """ - Wait until a volume has the desired status. Optional arguments tries - and interval set how many tries and how long to wait between polls - respectively. Will throw a RuntimeError if the status is ever - 'deleting', unless that is the desired status. Setting tries to 0 means - to try forever. Returns a dictionary describing the volume, see - vol_info(). - """ - forever = False - if tries == 0: - forever = True - timer = 1 - while timer <= tries or forever: - current = self.vol_info(vol_id) - if self.testmode: return None - if status in (current['status'], current.get('attach_status')): - return current - if 'deleting' in (current['status'], current.get('attach_status')): - raise RuntimeError, '%s is being deleted!' % vol_id - self.logger.info('Try #%s: %s not %s, sleeping %s seconds' % - (timer, vol_id, status, interval)) - time.sleep(interval) - timer += 1 - self._log_error('Timeout exceeded waiting for %s to be %s' % - (vol_id, status)) - - def take_snap(self, vol_id, wait=False): - """ - Snapshot a detached volume, returns the snapshot ID. If wait is set to - True, return once the snapshot is created. Returns a dictionary - that describes the snapshot. - """ - vol_info = self.vol_info(vol_id) - out = self.run_cmd('euca-create-snapshot -U %s %s' % - (self.rurl, vol_id))[0] - if self.testmode: return None - snap_id = out.split('\t')[1] - if wait: - info = self.wait_snap_status(snap_id, 'completed') - else: - info = self.snap_info(snap_id) - self.logger.info('snapshot %s taken' % snap_id) - return info - - def snap_info(self, snap_id): - """ - Return a dictionary that describes a snapshot: - id - the snapshot ID - vol_id - the volume ID the snapshot was taken from - status - pending, completed, etc - time - when the snapshot was created - """ - output = self.run_cmd('euca-describe-snapshots -U %s %s' % - (self.rurl, snap_id))[0] - if self.testmode: return None - bits = output.split('\t') - info = {} - attrs = ('id', 'vol_id', 'status', 'time') - for i in range(len(attrs)): - info[attrs[i]] = bits[i+1] - self.logger.debug('Retrieved snapshot info: %s' % info) - return info - - def wait_snap_status(self, snap_id, status, tries=0, interval=20): - """ - Wait until a snapshot is completes. Optional arguments tries and - interval set how many tries and how long to wait between polls - respectively. Setting tries to 0 means to try forever. Returns nothing. - """ - forever = False - if tries == 0: - forever = True - timer = 1 - while timer <= tries or forever: - current = self.snap_info(snap_id) - if self.testmode: return None - if current['status'] == status: - return current - self.logger.info('Try #%s: %s is not %s, sleeping %s seconds' % - (timer, snap_id, status, interval)) - time.sleep(interval) - timer += 1 - self._log_error('Timeout exceeded for %s to be %s' % (snap_id, status)) - - def register_snap(self, snap_id, arch, name, aki=None, desc=None, ari=None, - disk=False): - """ - Register an EBS volume snapshot as an AMI. Returns the AMI ID. An arch, - snapshot ID, and name for the AMI must be provided. Optionally - a description, AKI ID, and ARI ID may be specified too. - disk is whether or not we are registering a disk image. - """ - if aki == None: - aki = get_pvgrub(True, disk, self.region, arch) - cmd = 'euca-register -a %s -U %s -b /dev/sdf=ephemeral0 -b /dev/sdg=ephemeral1 -n "%s"' % \ - (arch, self.rurl, name) - if disk: - cmd += ' --virtualization-type hvm' - cmd += ' -b /dev/sda=%s --root-device-name /dev/sda' % snap_id - else: - cmd += ' --kernel %s' % aki - cmd += ' -b /dev/sda1=%s --root-device-name /dev/sda1' % snap_id - if ari != None: - cmd += ' --ramdisk %s' % ari - if desc != None: - cmd += ' -d "%s"' % desc - if self.testmode: - self.run_cmd(cmd) - return None - output = self.run_cmd(cmd)[0].strip() - ami_id = output.split('\t')[1] - if not ami_id.startswith('ami-'): - self._log_error('Could not register an AMI') - self.logger.info('Registered an AMI: %s' % ami_id) - return ami_id - - def register_snap2(self, snap_id, arch, name, aki=None, desc=None, - disk=False): - """Just like register_snap, except use boto""" - # need to define conn - conn = boto.ec2.connect_to_region(self.region, - aws_access_key_id=self.cred.access, - aws_secret_access_key=self.cred.secret) - if aki == None and not disk: - aki = get_pvgrub(True, disk, self.region, arch) - if disk: - dev = '/dev/sda' - else: - dev = '/dev/sda1' - ebs = boto.ec2.blockdevicemapping.EBSBlockDeviceType() - ebs.snapshot_id = snap_id - block_map = boto.ec2.blockdevicemapping.BlockDeviceMapping() - block_map[dev] = ebs - if disk: - result = conn.register_image(name=name, - description='Official Fedora AMI - %s' % name, - architecture=arch, - root_device_name=dev, block_device_map=block_map) - else: - result = conn.register_image(name=name, - description='Official Fedora AMI - %s' % name, - architecture=arch, kernel_id=aki, - root_device_name=dev, block_device_map=block_map) - self.logger.info('Registered an AMI: %s' % result) - return result - - def delete_snap(self, snap_id): - """ - USE WITH CAUTION! - - Delete an EBS volume snapshot. Returns the ID of the snapshot that was - deleted. - """ - out = self.run_cmd('euca-delete-snapshot -U %s %s' % - (self.rurl, snap_id))[0] - if self.testmode: return None - self.logger.info('Deleted a snapshot: %s' % snap_id) - return out.split('\t')[1].strip() - - def delete_vol(self, vol_id): - """ - USE WITH CAUTION! - - Delete an EBS volume. If snapshotted already it is safe to do this. - Returns the id of the volume that was deleted. - """ - output = self.run_cmd('euca-delete-volume -U %s %s' % - (self.rurl, vol_id))[0] - if self.testmode: return None - self.logger.info('Deleted a volume: %s' % vol_id) - return output.split('\t')[1].strip() - - def kill_inst(self, inst_id, wait=False): - """ - USE WITH CAUTION! - - Kill a running instance. Returns a dictionary describing the instance, - see inst_info for more information. Setting wait=True means we will not - return until the instance is terminated. - """ - self.run_cmd('euca-terminate-instances -U %s %s' % - (self.rurl, inst_id)) - if self.testmode: return None - if wait: - inst_info = self.wait_inst_status(inst_id, 'terminated') - else: - inst_info = self.inst_info(inst_id) - self.logger.info('Killed an instance: %s' % inst_id) - return inst_info - - def grant_access(self, ami, acct): - """ - Grant an account launch permissions to an AMI. - """ - self.run_cmd( - 'euca-modify-image-attribute -U %s %s -l -a %s' % - (self.rurl, ami, acct)) - if self.testmode: return None - self.logger.info('granted launch permissions of %s to %s' % - (ami, acct)) - - def revoke_access(self, ami, acct): - """ - Revoke launch permissions of an account for an AMI. - """ - self.run_cmd( - 'euca-modify-image-attribute -U %s %s -l -r %s' % - (self.rurl, ami, acct)) - if self.testmode: return None - self.logger.info('revoked launch permissions of %s for %s' % - (ami, acct)) - - def make_public(self, ami): - """ - Make an AMI publicly launchable. Should be used for Hourly images only! - """ - self.run_cmd( - 'euca-modify-image-attribute -U %s %s -l -a all' % (self.rurl, ami)) - if self.testmode: return None - self.logger.info('%s is now public!' % ami) - - def get_my_insts(self): - """ - Return a list of dicts that describe all running instances this account - owns. See inst_info for a description of the dict. - """ - mine = [] - output = self.run_cmd('euca-describe-instances %s -U %s' % - (self.rurl))[0].splitlines() - if self.testmode: return None - info = {} - for inst in output: - bits = inst.split('\t') - if bits[0] == 'RESERVATION': - info['reservation'], info['account'], info['group'] = bits[1:] - else: - attrs = ('id', 'ami', 'url', 'address', 'status', 'keypair', - 'index', 'vpc', 'type', 'time', 'zone', 'aki', 'ari') - for i in range(len(attrs)): - try: - info[attrs[i]] = bits[i+1] - except IndexError: - info[attrs[i]] = '' # ari is missing sometimes - mine.append(info) - info = {} - self.logger.debug('Retrieved instance info: %s' % info) - return mine - - def get_my_amis(self): - """ - Return a list of dicts that describe all AMIs this account owns. See - ami_info for a description of the dict; there is one difference though. - The snapid field may contain a list of snapshots in the blockmapping - for an image. It does not take just the first one. - """ - output = self.run_cmd('euca-describe-images -U %s -o self' % - (self.rurl))[0].split('\n') - if self.testmode: return None - attrs = ('id', 'source', 'owner', 'status', 'visibility', 'product', - 'arch', 'type', 'aki', 'ari') - mine = [] - info = {'snapid': []} - for image in output: - bits = image.split('\t') - if bits[0] == 'BLOCKDEVICEMAPPING': - info['snapid'].append(bits[3]) - elif bits[0] == 'IMAGE': - if info.get('id') != None and info.get('id').startswith('ami-'): - # we don't want AKIs or ARIs - mine.append(info.copy()) - info = {'snapid': []} - for i in range(len(attrs)): - try: - info[attrs[i]] = bits[i+1] - except IndexError: - info[attrs[i]] = '' - # do this once more to get the last line - if info.get('id') != None and info.get('id').startswith('ami-'): - mine.append(info.copy()) - self.logger.debug(str(mine)) - return mine - - def get_my_snaps(self): - """ - Return a list of dicts that describe all snapshots owned by this - account. See snap_info for a description of the dict. - """ - output = self.run_cmd('euca-describe-snapshots -U %s -o self' % - (self.rurl))[0].split('\n') - if self.testmode: return None - mine = [] - for snap in output: - bits = snap.split('\t') - info = {} - attrs = ('id', 'vol_id', 'status', 'time') - for i in range(len(attrs)): - info[attrs[i]] = bits[i+1] - mine.append(info.copy()) - self.logger.debug('Retrieved my snapshots: %s' % mine) - return mine - - # utility methods - - def run_cmd(self, cmd): - """ - Run a command and collect the output and return value. - """ - self.logger.debug('Command: %s' % cmd) - if self.testmode: - # Always return good status; we're just testing the commands - return 0, 0 - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, shell=True) - ret = proc.wait() - output = proc.stdout.read().strip() - self.logger.debug('Return code: %s' % ret) - self.logger.debug('Output: %s' % output) - if ret != 0: - self.logger.error('Command had a bad exit code: %s' % ret) - self.logger.error('Command run: %s' % cmd) - self.logger.error('Output:\n%s' % output) - raise Fedora_EC2Error('Command failed, see logs for output') - return output, ret - - def _log_error(self, msg): - """report and throw an error""" - self.logger.error(msg) - raise Fedora_EC2Error(msg) - - # SSH-specific methods - - def get_ssh_opts(self): - """return ssh options we want to use throughout this script""" - kp = os.path.join(self.keypath, - self.keys[self.cred.account][self.region]) + '.pem' - ssh_opts = '-i %s ' % kp + \ - '-o "StrictHostKeyChecking no" ' + \ - '-o "PreferredAuthentications publickey"' - return ssh_opts - - def run_ssh(self, instance, cmd): - """ssh to an instance and run a command""" - ssh_opts = self.get_ssh_opts() - ssh_host = 'root@%s' % instance['url'] - return self.run_cmd('ssh %s %s "%s"' % (ssh_opts, ssh_host, cmd)) - - def wait_ssh(self, instance, tries=0, interval=20): - """ - Continually attempt to ssh into an instance and return when we can. - This useful for when an instance is booting and we have to wait until - ssh is available. - """ - forever = False - if tries == 0: - forever = True - timer = 1 - while timer <= tries or forever: - try: - return self.run_ssh(instance, 'true') - except Fedora_EC2Error: - self.logger.warning('SSH failed, sleeping for %s seconds' % - interval) - time.sleep(interval) - timer += 1 - raise Fedora_EC2Error('Could not SSH in after %s tries' % tries) - diff --git a/scripts/cloud/test-fedora_ec2.py b/scripts/cloud/test-fedora_ec2.py deleted file mode 100755 index 0b13a38..0000000 --- a/scripts/cloud/test-fedora_ec2.py +++ /dev/null @@ -1,200 +0,0 @@ -#!/usr/bin/python -tt -# Copyright (C) 2013 Red Hat Inc. -# SPDX-License-Identifier: GPL-2.0+ - -import glob -import os -import subprocess -import sys -import time -import unittest - -import fedora_ec2 - -class TestFedora_EC2(unittest.TestCase): - - def setUp(self): - """Run before each test; create an EC2Obj for us to work with""" - self.cred = fedora_ec2.EC2Cred() - self.ec2 = fedora_ec2.EC2Obj('US', cred=self.cred, debug=True, quiet=False) - if self.cred.account != '125523088429': - raise RuntimeError('You can only test with the fedaws account') - self.keypair = 'releng-us-east' # this should exist in us-east - self.test_ami = 'ami-e291668b' # this too - self.test_vol = 'vol-ff185494' # and this - self.instances = [] - self.volumes = [] - - def test_obj_conf(self): - """test if EC2Obj optional parameters function""" - # We don't know what the id is because EC2Objs are created for each - # test case, and we don't know that ordering. - id = self.ec2.id - ec2_1 = fedora_ec2.EC2Obj('US', cred=self.cred, quiet=True) - ec2_2 = fedora_ec2.EC2Obj('us-west-1', cred=self.cred, quiet=True) - ec2_3 = fedora_ec2.EC2Obj('EU', quiet=True, debug=True, logfile='test.log') - ec2_4 = fedora_ec2.EC2Obj('ap-southeast-1', quiet=True) - ec2_5 = fedora_ec2.EC2Obj('ap-northeast-1', quiet=True) - self.assertEqual(ec2_1.id, id + 1) - self.assertEqual(ec2_2.id, ec2_1.id + 1) - self.assertEqual(ec2_3.id, ec2_2.id + 1) - self.assertEqual(ec2_4.id, ec2_3.id + 1) - self.assertEqual(ec2_5.id, ec2_4.id + 1) - self.assertEqual(ec2_1.region, 'us-east-1') - self.assertEqual(ec2_2.region, 'us-west-1') - self.assertEqual(ec2_3.region, 'eu-west-1') - self.assertEqual(ec2_4.region, 'ap-southeast-1') - self.assertEqual(ec2_5.region, 'ap-northeast-1') - files = os.listdir('.') - self.assertTrue('test.log' in files) - self.assertTrue('fedora_ec2.%s.log' % id in files) - self.assertEqual(ec2_3.cred.account, self.cred.account) - os.remove('test.log') - - def test_pvgrub(self): - """test pvgrub-specific code""" - self.assertEqual(fedora_ec2.get_pvgrub(True, False, 'us-east-1', - 'i386'), 'aki-407d9529') - self.assertEqual(fedora_ec2.get_pvgrub(True, False, 'us-east-1', - 'x86_64'), 'aki-427d952b') - #self.assertRaises(fedora_ec2.Fedora_EC2Error, - # fedora_ec2.get_pvgrub(True, True, 'fake', 'ppc64')) - - def test_regions(self): - """test region specific methods""" - self.assertEqual(self.ec2.alias_region('US'), 'us-east-1') - self.assertEqual(self.ec2.alias_region('us-east'), 'us-east-1') - self.assertEqual(self.ec2.alias_region('us-west'), 'us-west-1') - self.assertEqual(self.ec2.alias_region('EU'), 'eu-west-1') - self.assertEqual(self.ec2.alias_region('eu-west'), 'eu-west-1') - self.assertEqual(self.ec2.alias_region('us-east-1'), 'us-east-1') - self.assertEqual(self.ec2.alias_region('us-west-1'), 'us-west-1') - self.assertEqual(self.ec2.alias_region('eu-west-1'), 'eu-west-1') - self.assertEqual(self.ec2.alias_region('ap-southeast'), - 'ap-southeast-1') - self.assertEqual(self.ec2.alias_region('ap-southeast-1'), - 'ap-southeast-1') - self.assertEqual(self.ec2.alias_region('ap-northeast'), - 'ap-northeast-1') - self.assertEqual(self.ec2.alias_region('ap-northeast-1'), - 'ap-northeast-1') - self.assertEqual(self.ec2.alias_region('fake'), 'fake') - - def test_internals(self): - """test internal methods that consumers should not use""" - inst = 'i-47faec2d' # this doesn't really exist - vol = 'vol-3aa69553' # nor this - dev_a = self.ec2._take_dev(inst, vol) - self.assertTrue(dev_a.startswith('/dev/sd')) - self.assertEqual(self.ec2._att_devs[inst][dev_a], vol) - dev_b = self.ec2._release_dev(inst, vol) - self.assertEqual(dev_a, dev_b) - for dev in fedora_ec2.EC2Obj._devs.keys(): - self.assertEqual(self.ec2._att_devs[inst][dev], None) - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2._release_dev, inst, - vol) - for d in range(9): - self.ec2._take_dev(inst, vol[:-1] + str(d)) - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2._take_dev, inst, vol) - - def test_ami_methods(self): - """test methods that manipulate AMIs""" - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2.ami_info, 'fake') - ami_info = self.ec2.ami_info(self.test_ami) - self.assertEqual(ami_info['id'], self.test_ami) - self.assertEqual(ami_info['owner'], '125523088429') - self.assertEqual(ami_info['visibility'], 'public') - self.assertEqual(ami_info['arch'], 'x86_64') - self.assertEqual(ami_info['status'], 'available') - self.assertEqual(ami_info['type'], 'machine') - self.assertEqual(ami_info['aki'], 'aki-427d952b') - self.assertEqual(ami_info['ari'], ' ') - - # de-registration is checked in test_snapshot_methods - - def test_inst_methods(self): - """test the methods that interact with an instance""" - inst_info = self.ec2.start_ami(self.test_ami, zone='us-east-1c', - group='Basic') - self.instances.append(inst_info['id']) - self.assertTrue(inst_info['id'].startswith('i-')) - self.assertEqual(inst_info['ami'], self.test_ami) - self.assertEqual(inst_info['status'], 'pending') - self.assertEqual(inst_info['zone'], 'us-east-1c') - self.assertEqual(inst_info['group'], 'Basic') - new_info = self.ec2.inst_info(inst_info['id']) - for attr in ('id', 'ami', 'type', 'zone', 'time', 'aki', 'ari', - 'group', 'time'): - self.assertEqual(inst_info[attr], new_info[attr]) - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2.wait_inst_status, - new_info['id'], 'zomg', tries=3, interval=1) - new_info = self.ec2.wait_inst_status(new_info['id'], 'running') - self.assertEqual(new_info['status'], 'running') - self.assertEqual(new_info['id'], inst_info['id']) - new_info = self.ec2.kill_inst(new_info['id'], wait=True) - self.instances.pop() - self.assertEqual(new_info['id'], inst_info['id']) - self.assertEqual(new_info['status'], 'terminated') - - def test_vol_methods(self): - """test methods that work with volumes""" - zone = 'us-east-1c' - size = ' 20' - inst_info = self.ec2.start_ami(self.test_ami, zone=zone, wait=True) - self.instances.append(inst_info['id']) - vol_info = self.ec2.create_vol(size, zone, wait=True) - self.volumes.append(vol_info['id']) - self.assertEqual(vol_info['size'], size) - self.assertEqual(vol_info['zone'], zone) - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2.wait_vol_status, - vol_info['id'], 'zomg', tries=3, interval=1) - new_info = self.ec2.wait_vol_status(vol_info['id'], 'available') - self.assertEqual(new_info['id'], vol_info['id']) - self.assertEqual(new_info['status'], 'available') - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2.attach_vol, - inst_info['id'], new_info['id'], dev='fake') - att_info = self.ec2.attach_vol(inst_info['id'], new_info['id'], - wait=True) - self.assertEqual(att_info['attach_status'], 'attached') - self.assertEqual(att_info['id'], vol_info['id']) - self.assertEqual(att_info['instance'], inst_info['id']) - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2.vol_info, 'fake') - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2.attach_vol, - att_info['instance'], att_info['id']) - new_info = self.ec2.detach_vol(att_info['instance'], att_info['id'], - wait=True) - self.assertEqual(new_info['status'], 'available') - del_id = self.ec2.delete_vol(new_info['id']) - self.assertTrue(del_id, new_info['id']) - self.volumes.pop() - self.ec2.kill_inst(inst_info['id']) - self.instances.pop() - - def test_snapshot_methods(self): - """test methods that handle volume snapshots""" - snap_info = self.ec2.take_snap(self.test_vol, wait=True) - self.assertEqual(snap_info['vol_id'], self.test_vol) - self.assertEqual(snap_info['status'], 'completed') - ami_id = self.ec2.register_snap2(snap_info['id'], 'x86_64', 'Test') - self.assertTrue(ami_id.startswith('ami-')) - self.assertRaises(fedora_ec2.Fedora_EC2Error, self.ec2.delete_snap, - snap_info['id']) - self.ec2.deregister_ami(ami_id) - del_id = self.ec2.delete_snap(snap_info['id']) - self.assertEqual(del_id, snap_info['id']) - - def tearDown(self): - """Run after each test; remove log files we created""" - [os.remove(log) for log in glob.glob('fedora_ec2.*.log')] - # we try to clean up after ourselves if something failed - for inst in self.instances: - subprocess.Popen('ec2-terminate-instances %s' % inst, - stdout=subprocess.PIPE, close_fds=True, - stderr=subprocess.STDOUT, shell=True) - for vol in self.volumes: - subprocess.Popen('ec2-delete-volume %s' % inst, - stdout=subprocess.PIPE, close_fds=True, - stderr=subprocess.STDOUT, shell=True) - -if __name__ == '__main__': - unittest.main() diff --git a/scripts/cloud/upload-fedora-ebs.py b/scripts/cloud/upload-fedora-ebs.py deleted file mode 100755 index 4862765..0000000 --- a/scripts/cloud/upload-fedora-ebs.py +++ /dev/null @@ -1,236 +0,0 @@ -#!/usr/bin/python -tt -# Upload images to EBS volumes in EC2 in all regions -# Author: Jay Greguske -# Copyright (C) 2013 Red Hat Inc. -# SPDX-License-Identifier: GPL-2.0+ - -import logging -import math -from optparse import OptionParser -import os -import subprocess -import sys -import tempfile -import threading -import time - -import fedora_ec2 - -# -# Constants -# -# we assume whatever account we're using has access to the same set of AMIs -amis = { - 'us-east-1': {'i386': 'ami-e9ec2080', 'x86_64': 'ami-d9ed21b0'}, - 'us-west-1': {'i386': 'ami-3978247c', 'x86_64': 'ami-f1762ab4'}, - 'us-west-2': {'i386': 'ami-3c0a870c', 'x86_64': 'ami-3c0a870c'}, - 'eu-west-1': {'i386': 'ami-c9c4f6bd', 'x86_64': 'ami-69c5f71d'}, - 'ap-southeast-1': {'i386': 'ami-08007a5a', 'x86_64': 'ami-2c007a7e'}, - 'ap-southeast-2': {'i386': 'ami-a7b7209d', 'x86_64': 'ami-a7b7209d'}, - 'ap-northeast-1': {'i386': 'ami-6aab1f6b', 'x86_64': 'ami-ea9723eb'}, - 'sa-east-1': {'i386': 'ami-3038e72d', 'x86_64': 'ami-3038e72d'} -} -results = {} -result_lock = threading.Lock() -mainlog = None - -# -# Functions -# - -def get_options(): - usage = """ - Create EBS-backed AMI from a disk image. The process begins by starting an - instance creating an EBS volume and attaching it. The disk image is then - dd'ed to the EBS volume on the instance over ssh. That volume is snapshoted - and then registered as a new AMI. This script is threaded; one thread for - each region we want to upload to. Usually, image file names are of the form: - RHEL-X.Y-VariantName-Arch.raw - - Usage: %prog [options] path-to-image""" - parser = OptionParser(usage=usage) - parser.add_option('-a', '--arch', default=False, - help='Override the arch. Normally this is parsed from the file name.') - parser.add_option('-b', '--boot', help='Boot the EBS AMI afterward', - action='store_true', default=False) - parser.add_option('-d', '--debug', help='Print debug output', - action='store_true', default=False) - parser.add_option('-D', '--diskimage', action='store_true', default=False, - help='Upload a disk image rather than a partition image') - parser.add_option('-k', '--keep', help='Keep tmp instance/volumes around', - action='store_true', default=False) - parser.add_option('-l', '--logdir', help='specify a directory for logs', - default='.') - parser.add_option('-n', '--name', default=False, - help='Override the image name. The default is the disk image name.') - parser.add_option('-q', '--quiet', help='Just print to logs, not stdout', - action='store_true', default=False) - parser.add_option('-r', '--region', action='append', default=[], - help='Only upload to a specific region. May be used more than once.') - opts, args = parser.parse_args() - if len(args) != 1: - parser.error('Please specify a path to an image') - image = args[0] - if not os.path.exists(image): - parser.error('Could not find an image to upload at %s' % image) - size = os.stat(image).st_size - if not opts.diskimage: - if os.getuid() != 0: - parser.error('You have to be root to upload a partition image') - opts.size = int(math.ceil(size / 1024.0 / 1024.0 / 1024.0)) - opts.cred = fedora_ec2.EC2Cred() - if not opts.name: - opts.name = os.path.basename(image)[:-4] - if not opts.arch: - if 'i386' in opts.name: - opts.arch = 'i386' - elif 'x86_64' in opts.name: - opts.arch = 'x86_64' - else: - if 'i386' in os.path.basename(image): - opts.arch = 'i386' - elif 'x86_64' in os.path.basename(image): - opts.arch = 'x86_64' - else: - parser.error('Unable to determine arch. Please use --arch') - return opts, image - -def setup_log(logdir='.', quiet=False, debug=False): - """set up the main logger""" - global mainlog - format = logging.Formatter("[%(asctime)s %(name)s %(levelname)s]: %(message)s") - logname = 'upload-ebs' - if not os.path.exists(logdir): - os.makedirs(logdir) - mainlog = logging.getLogger(logname) - if debug: - mainlog.setLevel(logging.DEBUG) - else: - mainlog.setLevel(logging.INFO) - file_handler = logging.FileHandler(os.path.join(logdir, logname + '.log')) - file_handler.setFormatter(format) - mainlog.addHandler(file_handler) - if not quiet: - stdout_handler = logging.StreamHandler(sys.stdout) - stdout_handler.setFormatter(format) - mainlog.addHandler(stdout_handler) - -def run_cmd(cmd): - """run an external command""" - mainlog.debug('Command: %s' % cmd) - proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, - stderr=subprocess.STDOUT, shell=True) - ret = proc.wait() - output = proc.stdout.read().strip() - mainlog.debug('Return code: %s' % ret) - mainlog.debug('Output: %s' % output) - if ret != 0: - mainlog.error('Command had a bad exit code: %s' % ret) - mainlog.error('Command run: %s' % cmd) - mainlog.error('Output:\n%s' % output) - raise fedora_ec2.Fedora_EC2Error('Command failed, see logs for output') - return output, ret - -def prep_part(image): - """ - Use kpartx to mount a disk image and tweak grub.conf. - Return the partition loopback for uploading later. - """ - output, rc = run_cmd('/sbin/kpartx -a -v %s' % image) - lines = output.split('\n') - print lines - loop = lines[0].split()[2] - print loop - time.sleep(3) - mainlog.info('mounted disk image; partition available on %s' % loop) - mapdev = os.path.join('/dev/mapper', loop) - tmpdir = tempfile.mkdtemp(prefix='ebs-mnt-') - run_cmd('/bin/mount %s %s' % (mapdev, tmpdir)) - mainlog.info('mount on %s' % tmpdir) -# run_cmd("/bin/sed -i -e 's/(hd0,0)/(hd0)/' %s/boot/grub/menu.lst" % - run_cmd("/bin/sed -i -e 's/(hd0,0)/(hd0)/' %s/boot/grub/grub.conf" % - tmpdir) - mainlog.info('tweaked menu.lst to boot as a partition') - run_cmd('/bin/umount %s' % tmpdir) - mainlog.warning('%s will no longer boot as a disk image' % image) - return mapdev - -def unmount_part(image): - """clean up loopback droppings""" - loop = os.path.basename(image) - run_cmd('dmsetup remove %s' % loop) - run_cmd('losetup -d /dev/%s' % loop[:loop.rindex('p')]) - mainlog.info('cleaned up loopback device pieces') - -def upload_region(region, image_path, opts): - """Upload an image to a region""" - # start the Stager instance - ec2 = fedora_ec2.EC2Obj(region=region, cred=opts.cred, debug=opts.debug, - logfile=os.path.join(opts.logdir, 'rcm-%s.log' % region), - quiet=opts.quiet) - mainlog.info('beginning process for %s to %s' % (image_path, ec2.region)) - inst_info = ec2.start_ami(amis[ec2.region][opts.arch], wait=True) - - # create and attach volumes - mainlog.info('[%s] creating EBS volume we will snapshot' % ec2.region) - ebs_vol_info = ec2.create_vol(opts.size, wait=True) - ebs_vol_info = ec2.attach_vol(inst_info['id'], ebs_vol_info['id'], - wait=True) - - # prep the temporary volume and upload to it - ec2.wait_ssh(inst_info) - mainlog.info('[%s] uploading image %s to EBS volume' % - (ec2.region, image_path)) - run_cmd('dd if=%s bs=4096 | ssh %s -C root@%s "dd of=%s bs=4096"' % - (image_path, ec2.get_ssh_opts(), inst_info['url'], - ebs_vol_info['device'])) - - # detach the two EBS volumes, snapshot the one we dd'd the disk image to, - # and register it as an AMI - ec2.detach_vol(inst_info['id'], ebs_vol_info['id'], wait=True) - snap_info = ec2.take_snap(ebs_vol_info['id'], wait=True) - new_ami = ec2.register_snap2(snap_info['id'], opts.arch, opts.name, - disk=opts.diskimage) - - # boot them if asked - if opts.boot: - ec2.start_ami(new_ami) - - # grant access to the new AMIs -- TBD - - # cleanup - if not opts.keep: - mainlog.info('[%s] cleaning up' % ec2.region) - ec2.delete_vol(ebs_vol_info['id']) - ec2.kill_inst(inst_info['id']) - mainlog.info('%s is complete' % ec2.region) - mainlog.info('[%s] AMI ID: %s' % (ec2.region, new_ami)) - - # maintain results - result_lock.acquire() - results[new_ami] = '%s image for %s' % (ec2.region, opts.arch) - result_lock.release() - -if __name__ == '__main__': - opts, ipath = get_options() - setup_log(logdir=opts.logdir, quiet=opts.quiet, debug=opts.debug) - if not opts.diskimage: - ipath = prep_part(ipath) - threads = [] - if len(opts.region) > 0: - for region in opts.region: - threads.append(threading.Thread(target=upload_region, - args=(region, ipath, opts), name=region)) - else: - for region in amis.keys(): - threads.append(threading.Thread(target=upload_region, - args=(region, ipath, opts), name=region)) - for t in threads: - t.start() - for t in threads: - t.join() - if not opts.diskimage: - unmount_part(ipath) - mainlog.info('Results of all uploads follow this line\n') - mainlog.info('\n'.join(['%s : %s' % (k, v) for k, v in results.items()])) - diff --git a/scripts/distcvs2distgit.py b/scripts/distcvs2distgit.py deleted file mode 100755 index f263932..0000000 --- a/scripts/distcvs2distgit.py +++ /dev/null @@ -1,165 +0,0 @@ -#!/usr/bin/python -# -# distcvs2distgit.py - A utility to convert Fedora's dist-cvs package repos -# into git repos -# -# Copyright (C) 2013 Red Hat Inc, -# SPDX-License-Identifier: GPL-2.0 -# -# Authors: -# Jesse Keating -# - -import os -import errno -import shutil -import sys -import subprocess - -status = 0 -modules = [] -CVSROOT = '/home/fedora/jkeating/pkgs/rpms' -PARSECVS = '/home/fedora/jkeating/parsecvs.bak/parsecvs' -WORKDIR = '/home/fedora/jkeating/workdir' -OUTDIR = '/home/fedora/jkeating/repos' -BRANCHES = ['F-13', 'F-12', 'F-11', 'F-10', 'F-9', 'F-8', 'F-7', 'devel', - 'EL-6', 'EL-5', 'EL-4', 'OLPC-2', 'OLPC-3', 'FC-6'] -AUTHOR = "Fedora Release Engineering " - -# Define some useful functions -# This was stolen from http://stackoverflow.com/questions/600268/mkdir-p-functionality-in-python -def mkdir_p(path): - try: - os.makedirs(path) - except OSError, exc: - if exc.errno == errno.EEXIST: - pass - else: raise - -# Get a list of modules -modules = sorted(os.listdir(CVSROOT)) -#modules = ['CCfits'] -print "Got %s modules" % len(modules) - -curdir = os.getcwd() -# Cycle through each module and do some work -for module in modules: - if not os.path.isdir(os.path.join(CVSROOT, module)): - #print "Skipping %s, not a module" % module - continue - if os.path.isdir(os.path.join(OUTDIR, "%s.git" % module)): - #print "Skipping already done module" - continue - if module == 'kernel': - print "Skipping kernel" - try: - os.chdir(curdir) - # Find branches for this build - branches = [] - dirs = os.listdir(os.path.join(CVSROOT, module)) - for dir in dirs: - if dir in BRANCHES: - branches.append(dir) - - # Bail if we don't have a devel branch - if 'devel' not in branches: - print "Skipping %s, no devel branch" % module - continue - - if os.path.exists(os.path.join(WORKDIR, module)): - shutil.rmtree(os.path.join(WORKDIR, module)) - - # Cycle through the branches to import - for branch in branches: - # Make our output dir - mkdir_p(os.path.join(WORKDIR, module, branch)) - # Find all the ,v files, then stuff that output into parsecvs - findpath = os.path.join(CVSROOT, module, branch) - gitdir = os.path.join(WORKDIR, module, branch) - enviro = os.environ - enviro['GIT_DIR'] = gitdir - findcmd = ['find', findpath, '-name', '*,v'] - findcall = subprocess.Popen(findcmd, stdout=subprocess.PIPE) - thecmd = [PARSECVS] - thecmd.extend(['-l', 'parsecvs.bak/edit-change-log']) - - subprocess.check_call(thecmd, env=enviro, - stdin=findcall.stdout, - stdout=sys.stdout, - stderr=sys.stderr) - - if 'GIT_DIR' in enviro.keys(): - del enviro['GIT_DIR'] - - # Now scrub some stuff out and move it around - clonedir = os.path.join(WORKDIR, module, 'tmp') - # Clean it out if it exists - if os.path.exists(clonedir): - shutil.rmtree(clonedir) - mkdir_p(clonedir) - clone = ['git', 'clone', '--no-hardlinks', gitdir, clonedir] - subprocess.check_call(clone, stdout=sys.stdout, stderr=sys.stderr) - os.chdir(clonedir) - cmd = ['git', 'rm'] - run = False - commit = False - for rmfile in ('import.log', 'branch', 'Makefile'): - if os.path.exists(rmfile): - run = True - cmd.append(rmfile) - if run: - subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr) - commit = True - if os.path.exists('.cvsignore'): - cmd = ['git', 'mv', '.cvsignore', '.gitignore'] - subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr) - commit = True - if commit: - cmd = ['git', 'commit', '-m', 'dist-git conversion', - '--author', AUTHOR] - subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr) - cmd = ['git', 'push'] - subprocess.check_call(cmd, stdout=sys.stdout, stderr=sys.stderr) - os.chdir(curdir) - - # Kill GIT_DIR from the environment - if 'GIT_DIR' in enviro.keys(): - del enviro['GIT_DIR'] - # Now fetch the changes from the branch repos into the main repo - develpath = os.path.join(WORKDIR, module, 'devel') - for branch in branches: - if branch == 'devel': - continue - gitcmd = ['git', 'fetch', os.path.join(WORKDIR, module, branch), - 'master:%s/master' % branch.replace('-', '').lower()] - subprocess.check_call(gitcmd, cwd=develpath, stdout=sys.stdout, - stderr=subprocess.STDOUT, env=enviro) - # get fetch stupidly sends useful stuff to stderr so we just stuff that - # into stdout - - # Repack the repo to make it small - gitcmd = ['git', 'repack', '-a', '-d', '-f', '--window=50', '--depth=20'] - subprocess.check_call(gitcmd, cwd=develpath, stdout=sys.stdout, - stderr=sys.stderr) - - # Write the module name in the description - open(os.path.join(develpath, 'description'), 'w').write('%s\n' % module) - - # Set up the mailing list hook - gitcmd = ['git', 'config', '--add', 'hooks.mailinglist', - '%s-owner@fedoraproject.org,scm-commits@lists.fedoraproject.org' % module] - subprocess.check_call(gitcmd, cwd=develpath, stdout=sys.stdout, - stderr=sys.stderr) - - # Now move it into our output dir - os.rename(develpath, os.path.join(OUTDIR, module + '.git')) - - - # Now clean out the work tree - shutil.rmtree(os.path.join(WORKDIR, module)) - - except: - print('Error with %s' % module) - continue - -print "All done!" diff --git a/scripts/make-updates b/scripts/make-updates deleted file mode 100755 index 74faf94..0000000 --- a/scripts/make-updates +++ /dev/null @@ -1,131 +0,0 @@ -#!/bin/bash - -umask 002 - -# Copyright (C) 2015 Red Hat, Inc. -# SPDX-License-Identifier: GPL-2.0+ - -VERSION=$1 -COMPOSE=$2 -DATE=$3 -BRANCH=$(echo $VERSION|sed -e 's|_.*||g') -DESTDIR=/srv/pungi/$VERSION-$DATE/ -FINALDEST=/mnt/fedora_koji/compose/$VERSION-$DATE/ -KICKSTARTS=/srv/pungi/spin-kickstarts/ -ATOMIC=/srv/pungi/fedora-atomic/ -ATOMICDEST=/srv/pungi/atomic/ -MIRRORDEST=/pub/alt/atomic/testing/$VERSION-$DATE/ -PUBLICDEST="https://dl.fedoraproject.org$MIRRORDEST" -SHORTCOMPOSE=$(echo $COMPOSE|sed -e 's|_RC||g') -SHORTVERSION=$VERSION -[ -z "$COMPOSE" ] && { - SHORTVERSION=$(echo $VERSION|sed -e 's|_T.*||') - SHORTCOMPOSE=$(echo $VERSION|sed -e 's|.*_||g') -} - -FEDMSG_MODNAME="compose" -FEDMSG_CERTPREFIX="releng" -fedmsg_json_start=$(printf '{"log": "start", "branch": "%s"}' "${BRANCH}") -fedmsg_json_start_loc=$(printf '{"log": "start", "branch": "%s", "location": "%s"}' "${BRANCH}" "${PUBLICDEST}") -fedmsg_json_done=$(printf '{"log": "done", "branch": "%s"}' "${BRANCH}") -fedmsg_json_done_loc=$(printf '{"log": "done", "branch": "%s", "location": "%s"}' "${BRANCH}" "${PUBLICDEST}") -. ./scripts/fedmsg-functions.sh - -FULLPATH=$(pwd) -pushd $KICKSTARTS -git reset --hard -git checkout f$VERSION -git pull --rebase - -send_fedmsg "${fedmsg_json_start}" ${BRANCH} make-updates.start -send_fedmsg "${fedmsg_json_start}" ${BRANCH} cloudimg-build.start -$FULLPATH/scripts/build-cloud-images "$VERSION" "$DATE" "$BRANCH" "$COMPOSE" -popd - -send_fedmsg "${fedmsg_json_start}" ${BRANCH} mash-atomic.start -mash -c configs/mash.conf ${VERSION}-atomic-updates -o /mnt/koji/mash/atomic-updates/${VERSION}-${DATE}/ -send_fedmsg "${fedmsg_json_start}" ${BRANCH} mash-atomic.stop -# use the latest updated kickstarts -pushd $ATOMIC -git reset --hard -git checkout f$VERSION -git pull --rebase - -mock -r fedora-$VERSION-compose-x86_64 --init || exit 1 -mock -r fedora-$VERSION-compose-x86_64 --install lorax rpm-ostree || exit 1 -mock -r fedora-$VERSION-compose-x86_64 --shell "mkdir -p ${DESTDIR}/Cloud_Atomic/x86_64/iso; mkdir -p ${DESTDIR}/logs" - -send_fedmsg "${fedmsg_json_start}" ${BRANCH} atomic-lorax.start -mock -r fedora-$VERSION-compose-x86_64 --shell "lorax --nomacboot -p Fedora -v ${SHORTVERSION} -r ${SHORTCOMPOSE} \ - -s http://infrastructure.fedoraproject.org/pub/fedora/linux/releases/$VERSION/Everything/x86_64/os/ \ - -s http://kojipkgs.fedoraproject.org/mash/atomic-updates/$VERSION-$DATE/$VERSION-atomic-updates/x86_64/ \ - -i fedora-productimg-atomic \ - -t Cloud_Atomic \ - --tmp /tmp/ \ - --logfile=${DESTDIR}/logs/atomic \ - --add-template /srv/pungi/spin-kickstarts/atomic-installer/lorax-configure-repo.tmpl \ - --add-template-var=ostree_osname=fedora-atomic \ - --add-arch-template-var=ostree_repo=https://kojipkgs.fedoraproject.org/mash/atomic/$VERSION/ \ - --add-template-var=ostree_ref=fedora-atomic/f${VERSION}/x86_64/docker-host \ - --add-arch-template /srv/pungi/spin-kickstarts/atomic-installer/lorax-embed-repo.tmpl \ - --add-arch-template-var=ostree_osname=fedora-atomic \ - --add-arch-template-var=ostree_ref=fedora-atomic/f${VERSION}/x86_64/docker-host \ - --isfinal \ - ${DESTDIR}/Cloud_Atomic/x86_64/os/ " || exit 1 -mock -r fedora-$VERSION-compose-x86_64 --shell "cp -l ${DESTDIR}/Cloud_Atomic/x86_64/os/images/boot.iso ${DESTDIR}/Cloud_Atomic/x86_64/iso/Fedora-Cloud_Atomic-x86_64-${VERSION}-${DATE}.iso" || exit 1 -mock -r fedora-$VERSION-compose-x86_64 --shell "pushd ${DESTDIR}/Cloud_Atomic/x86_64/iso/ ;sha256sum -b --tag *iso >Fedora-Cloud_Atomic-${VERSION}-x86_64-CHECKSUM; popd" || exit 1 -send_fedmsg "${fedmsg_json_done}" ${BRANCH} atomic-lorax.done - -popd - -while true -do - if [ $(koji list-tasks --mine|grep OPEN|grep -e image -e livecd -e appliance|wc -l) -ne 0 ] - then - echo "image, appliance or livecd tasks running, waiting 2 minutes" - sleep 120 - else - break - fi -done -send_fedmsg "${fedmsg_json_done}" ${BRANCH} cloudimg-build.done - -sg releng-team "mkdir -p $FINALDEST" -pushd $FINALDEST/ -sg releng-team "mkdir -p Cloud-Images/i386/Images Cloud-Images/x86_64/Images Docker/x86_64 Docker/armhfp" -popd - - -USER=$(whoami) -# stage images -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Cloud*$VERSION-$DATE\.i386.raw.xz $FINALDEST/Cloud-Images/i386/Images/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Cloud*$VERSION-$DATE\.i386.qcow2 $FINALDEST/Cloud-Images/i386/Images/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Cloud*$VERSION-$DATE\.x86_64.raw.xz $FINALDEST/Cloud-Images/x86_64/Images/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Cloud*$VERSION-$DATE\.x86_64.qcow2 $FINALDEST/Cloud-Images/x86_64/Images/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Cloud*$VERSION-$DATE\.x86_64.*.box $FINALDEST/Cloud-Images/x86_64/Images/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Docker*-$VERSION-$DATE*x86_64.tar.xz $FINALDEST//Docker/x86_64/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Docker*-$VERSION-$DATE*armhfp.tar.xz $FINALDEST//Docker/armhfp/" - - - -send_fedmsg "${fedmsg_json_start}" ${BRANCH} cloudimg-checksum.start -pushd $FINALDEST/Cloud-Images -for arch in i386 x86_64; do pushd $arch/Images; sg releng-team "sha256sum --tag -b *qcow2 *raw.xz *box> Fedora-Cloud-Images-$arch-$VERSION-CHECKSUM"; popd; done -popd - -pushd $FINALDEST/Docker -for arch in x86_64 armhfp; do pushd $arch; sg releng-team "sha256sum --tag -b *tar.xz> Fedora-Docker-$arch-$VERSION-CHECKSUM"; popd; done -popd -send_fedmsg "${fedmsg_json_done}" ${BRANCH} cloudimg-checksum.done - - - -send_fedmsg "${fedmsg_json_start_loc}" ${BRANCH} cloudimg-staging.start -# stage the composed tree to final locateion -sg releng-team "mkdir $MIRRORDEST" -sg releng-team "chmod 700 $MIRRORDEST" -for type in Cloud_Atomic Docker Cloud-Images; do sg releng-team "rsync -avhH $FINALDEST/$type/ $MIRRORDEST/$type/"; done -sg releng-team "chmod 755 $MIRRORDEST" -send_fedmsg "${fedmsg_json_done_loc}" ${BRANCH} cloudimg-staging.done - -send_fedmsg "${fedmsg_json_done}" ${BRANCH} make-updates.done diff --git a/scripts/makebleed b/scripts/makebleed deleted file mode 100755 index 50c82b7..0000000 --- a/scripts/makebleed +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2013 Red Hat, Inc. -# SPDX-License-Identifier: GPL-2.0+ - -PKGS="$@" -BLEEDDIR=/mnt/fedora_koji/compose/bleed/ -pushd $BLEEDDIR - -for pkg in $PKGS -do - sg releng-team "koji download-build --key=34ec9cba $pkg" -done - -sg releng-team "mv *src.rpm SRPMS/;mv *i686.rpm i386/ ; mv *x86_64.rpm x86_64/; mv *armv7hl.rpm armhfp/" - -sg releng-team "cp *noarch.rpm armhfp/ &&cp *noarch.rpm i386/ && mv *noarch.rpm x86_64/" - -for dir in armhfp i386 x86_64 SRPMS -do - sg releng-team "createrepo --update -d $dir" -done - -sg releng-team "rsync -avhH --delete $BLEEDDIR /mnt/fedora_koji/koji/mash/bleed/" - -popd diff --git a/scripts/need-rebuild-gcc43.py b/scripts/need-rebuild-gcc43.py deleted file mode 100755 index f15a82a..0000000 --- a/scripts/need-rebuild-gcc43.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) 2013 Red Hat, Inc. -# SPDX-License-Identifier: GPL-2.0+ -# template for finding builds that meet some time/buildroot component critera. -# Edit to suit. - -import koji -import datetime - -## releng folks, update the blacklist below for packages that the maintainer -## wishes to opt-out of autorebuilding. - -blacklist = [] -#['thunderbird','banshee','epiphany','epiphany-extensions','libipoddevice','malaga-suomi-voikko','bless','sysvinit','mecab-ipadic','mecab-jumandic','kazehakase','qt','knetworkmanager','autogen','bacula','xfdesktop','fontforge', -#'anjuta','gengetopt','pida','openbabel','plplot','paraview'] - -kojisession = koji.ClientSession('http://koji.fedoraproject.org/kojihub') -tocheck = [] -needbuild = [] -reallyneedbuild = [] -ownermap = {} - -print datetime.datetime.isoformat(datetime.datetime.utcnow()) - -f9builds = kojisession.listTagged('f20', inherit=True, latest=True) -pkgs = kojisession.listPackages('f20', inherited=True) - -for pkg in pkgs: - ownermap[pkg['package_name']] = pkg['owner_name'] - -for build in f9builds: - if build['creation_time'] < '2013-11-09 23:43:46.000000': - tocheck.append(build) - -checknum = len(tocheck) - -for build in tocheck: - if build['name'] in blacklist: - continue - print "Checking %s (%s of %s)" % (build['nvr'], tocheck.index(build)+1, checknum) - if not build['task_id']: - rpms = kojisession.listRPMs(buildID=build['build_id']) - for rpm in rpms: - if rpm['arch'] != 'src' and rpm['arch'] != 'noarch': - needbuild.append(build) - continue - continue - for task in kojisession.getTaskChildren(build['task_id']): - if build in needbuild: - continue - if task['method'] == 'buildArch': - if task['arch'] == 'noarch': - print "noarch build, skipping task", task['id'] - continue - for rootid in kojisession.listBuildroots(taskID=task['id']): - for pkg in kojisession.listRPMs(componentBuildrootID=rootid['id']): - if pkg['name'] == 'gcc': - if pkg['version'] == '4.8.2' and pkg['release'] == '1.fc20' : - if not build in needbuild: - print "adding", build['name'] - needbuild.append(build) - continue - continue - -rebuildnames = [] -for build in needbuild: - if not build in reallyneedbuild: - reallyneedbuild.append(build) - rebuildnames.append("%s %s" % (ownermap[build['name']], build['name'])) - -rebuildnames.sort() -for build in rebuildnames: - print build diff --git a/scripts/pungify b/scripts/pungify deleted file mode 100755 index f6b311a..0000000 --- a/scripts/pungify +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -x - -# Copyright (C) 2013 Red Hat, Inc. -# SPDX-License-Identifier: GPL-2.0+ -# pungify - run pungi on a particular rawhide tree -# needs passed: -# the tree version (usually a datestamp) -# the arch -# the hostname to connect to (can be user@host) -# -# Hosts must have valid mock development configs. More paths are hardcoded in this script than probably should be. - -TREE=$1 - -BRANCH=$2 - -ARCH=$3 - -HOST=$4 - -DIST=$5 - -usage() { - echo "Usage: pungify " - exit 1 -} - -[ -z "$TREE" -o -z "$BRANCH" -o -z "$ARCH" -o -z "$HOST" ] && usage - -ssh mock@$HOST /bin/bash -- << EOF - set -x - mock -r fedora-$DIST-pungi-$ARCH --uniqueext=$TREE --init || exit 1 - mock -r fedora-$DIST-pungi-$ARCH --uniqueext=$TREE --install pungi nfs-utils setarch || exit 1 - mock -r fedora-$DIST-pungi-$ARCH --uniqueext=$TREE --arch $ARCH shell -- << EEE -set -x -mkdir -p /tmp/treebuild.$TREE/{output,cache,$BRANCH} -cd /tmp/treebuild.$TREE -touch rawhide.ks -echo "repo --name=fedora --baseurl=file:///tmp/treebuild.$TREE/output/$BRANCH/$ARCH/os/ --exclude=fedora-productimg-cloud,fedora-productimg-server,fedora-productimg-workstation" > rawhide.ks -mount -t nfs -o nfsvers=3,ro,nolock ntap-phx2-c01-fedora01-nfs.storage.phx2.redhat.com:/fedora_koji/koji/mash/$DIST-$TREE/$BRANCH $BRANCH -rm -f /var/lib/rpm/__db* -mkdir -p output/$BRANCH/$ARCH/os/ -ln -s /tmp/treebuild.$TREE/$BRANCH/$ARCH/os/Packages output/$BRANCH/$ARCH/os/Packages -ln -s /tmp/treebuild.$TREE/$BRANCH/$ARCH/os/repodata output/$BRANCH/$ARCH/os/repodata -pungi -c ./rawhide.ks -B --destdir /tmp/treebuild.$TREE/output --cachedir /tmp/treebuild.$TREE/cache --ver $BRANCH -umount $BRANCH -rm -rf output/$BRANCH/$ARCH/os/{Packages,repodata} -EEE -EOF -# so, so wrong -rsync -vaH mock@$HOST:/var/lib/mock/fedora-$DIST-pungi-$ARCH-$TREE/root/tmp/treebuild.$TREE/output/$BRANCH/$ARCH/os/ /mnt/koji/mash/$DIST-$TREE/$BRANCH/$ARCH/os/ -rsync -vaH mock@$HOST:/var/lib/mock/fedora-$DIST-pungi-$ARCH-$TREE/root/tmp/treebuild.$TREE/output/logs/ /mnt/koji/mash/$DIST-$TREE/logs/$ARCH/ -ssh mock@$HOST /bin/bash -- << EOF - set -x - mock -r fedora-$DIST-pungi-$ARCH --uniqueext=$TREE clean -EOF diff --git a/scripts/run-pungi b/scripts/run-pungi deleted file mode 100755 index ae405d7..0000000 --- a/scripts/run-pungi +++ /dev/null @@ -1,261 +0,0 @@ -#!/bin/bash - - -# Copyright (C) 2013-2014 Red Hat, Inc. -# SPDX-License-Identifier: GPL-2.0+ - -VERSION=$1 -COMPOSE=$2 -DATE=$3 -BRANCH=$(echo $VERSION|sed -e 's|_.*||g') -DESTDIR=/srv/pungi/$VERSION$COMPOSE/ -FINALDEST=/mnt/fedora_koji/compose/$VERSION$COMPOSE/ -KICKSTARTS=/srv/pungi/spin-kickstarts/ -ATOMIC=/srv/pungi/fedora-atomic/ -ATOMICDEST=/srv/pungi/atomic/ - -# SHORTCOMPOSE: a short reference to the compmose it is 1 for RC1 and TC1 for TC1 -# BUILD: added for QA to refer to the compose by RC1 or TC1 -# MILESTONE: is for QA refers to Alpha/Beta/Final -# SHORTVERSION: is a shortened version of the Version passed in drops off _TCX -# COMPOSE: is passed in for RC's only in the format of _RCX - -SHORTCOMPOSE=$(echo $COMPOSE|sed -e 's|_RC||g') -BUILD=$(echo $COMPOSE|sed -e 's|_||g') -MILESTONE=$(echo $VERSION|sed -e 's|_T.*||' -e 's|.*_||') -SHORTVERSION=$VERSION -[ -z "$COMPOSE" ] && { - SHORTVERSION=$(echo $VERSION|sed -e 's|_T.*||') - SHORTCOMPOSE=$(echo $VERSION|sed -e 's|.*_||g') - BUILD=$(echo $VERSION|sed -e 's|.*_||g') -} - -[ -z "$MILESTONE" ] && { - MILESTONE=Final -} - -sg releng-team "mkdir -p $DESTDIR/logs" - -FULLPATH=$(pwd) -pushd $KICKSTARTS -git reset --hard -git checkout f$BRANCH -git pull --rebase -sed -i -e 's|repo --name=fedora .*$|repo --name=fedora --baseurl=http://kojipkgs.fedoraproject.org/mash/branched/$basearch/os/ \nrepo --name=bleed --baseurl=http://kojipkgs.fedoraproject.org/mash/bleed/$basearch|g' fedora-install-*.ks -sed -i -e 's|repo --name=fedora-source .*$|repo --name=fedora-source --baseurl=http://kojipkgs.fedoraproject.org/mash/branched/source/SRPMS/\nrepo --name=bleed-source --baseurl=http://kojipkgs.fedoraproject.org/mash/bleed/SRPMS|g' fedora-install-*.ks -$FULLPATH/build-livecds "$SHORTVERSION" "$SHORTCOMPOSE" "$BRANCH" -$FULLPATH/build-arm-images "$SHORTVERSION" "$SHORTCOMPOSE" "$BRANCH" -pushd - -pushd $ATOMIC - git reset --hard - git pull --rebase - echo '[fedora-bleed] -name=fedora-bleed -gpgcheck=1 -gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-23-$basearch -enabled=1 -baseurl=http://kojipkgs.fedoraproject.org/mash/bleed/$basearch/' > fedora-bleed.repo - sed -i -e 's|mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-23&arch=$basearch|baseurl=http://kojipkgs.fedoraproject.org/mash/branched/$basearch/os/|g' fedora*repo - # make sure we add the bleed repo to the json file - sed -i -e 's|\["fedora-23"\]|\["fedora-23", "fedora-bleed"\]|g' *json - mock -r fedora-branched-compose-x86_64 --init || exit 1 - mock -r fedora-branched-compose-x86_64 --install rpm-ostree lorax || exit 1 - mock -r fedora-branched-compose-x86_64 --shell "if [ ! -d $ATOMICDEST ]; then ostree init --repo=$ATOMICDEST --mode=archive-z2;fi" - mock -r fedora-branched-compose-x86_64 --shell "rpm-ostree compose tree --repo=$ATOMICDEST $ATOMIC/fedora-atomic-docker-host.json >$DESTDIR/logs/atomic-repo" || exit 1 - mock -r fedora-branched-compose-x86_64 --shell "mkdir -p $DESTDIR/$VERSION/Cloud_Atomic/x86_64/iso" - mock -r fedora-branched-compose-x86_64 --shell "lorax --nomacboot -p Fedora -v $SHORTVERSION -r $SHORTCOMPOSE \ - -s http://kojipkgs.fedoraproject.org/mash/branched/x86_64/os/ \ - -s http://kojipkgs.fedoraproject.org/mash/bleed/x86_64/ \ - -i fedora-productimg-atomic \ - -t Cloud_Atomic \ - --tmp /tmp/ \ - --logfile=$DESTDIR/logs/atomic \ - --add-template /srv/pungi/spin-kickstarts/atomic-installer/lorax-configure-repo.tmpl \ - --add-template-var=ostree_osname=fedora-atomic \ - --add-arch-template-var=ostree_repo=http://compose-x86-01.phx2.fedoraproject.org/compose/atomic/ \ - --add-template-var=ostree_ref=fedora-atomic/f23/x86_64/docker-host \ - --add-arch-template /srv/pungi/spin-kickstarts/atomic-installer/lorax-embed-repo.tmpl \ - --add-arch-template-var=ostree_osname=fedora-atomic \ - --add-arch-template-var=ostree_ref=fedora-atomic/f23/x86_64/docker-host \ - $DESTDIR/$VERSION/Cloud_Atomic/x86_64/os/ " || exit 1 - mock -r fedora-branched-compose-x86_64 --shell "cp -l $DESTDIR/$VERSION/Cloud_Atomic/x86_64/os/images/boot.iso $DESTDIR/$VERSION/Cloud_Atomic/x86_64/iso/Fedora-Cloud_Atomic-x86_64-$VERSION.iso" || exit 1 - mock -r fedora-branched-compose-x86_64 --shell "pushd $DESTDIR/$VERSION/Cloud_Atomic/x86_64/iso/ ;sha256sum -b --tag *iso >Fedora-Cloud_Atomic-$VERSION-x86_64-CHECKSUM; popd" || exit 1 - - #mock -r fedora-branched-compose-x86_64 --shell "livemedia-creator " || exit 1 - -popd - -for arch in armhfp i386 x86_64 -do - mock -r fedora-branched-compose-i386 --init || exit 1 - mock -r fedora-branched-compose-i386 --shell "pungi -c $KICKSTARTS/fedora-install-workstation.ks --destdir $DESTDIR --cachedir /srv/pungi/cache/ --arch=$arch -G -C --ver $VERSION --workdirbase=/tmp/work --family Fedora --variant Workstation --installpkgs fedora-productimg-workstation" || exit 1 - mock -r fedora-branched-compose-i386 --shell "pungi -c $KICKSTARTS/fedora-install-server.ks --destdir $DESTDIR --cachedir /srv/pungi/cache/ --arch=$arch -G -C --ver $VERSION --workdirbase=/tmp/work --family Fedora --variant Server --installpkgs fedora-productimg-server" || exit 1 - mock -r fedora-branched-compose-i386 --shell "pungi -c $KICKSTARTS/fedora-install-cloud.ks --destdir $DESTDIR --cachedir /srv/pungi/cache/ --arch=$arch -G -C --ver $VERSION --workdirbase=/tmp/work --family Fedora --variant Cloud --installpkgs fedora-productimg-cloud" || exit 1 - mock -r fedora-branched-compose-i386 --clean || exit 1 -done - -for arch in armhfp i386 x86_64 -do - if [[ $arch == armhfp ]] - then HOST=arm01-releng02.arm.fedoraproject.org - else HOST=compose-x86-01.phx2.fedoraproject.org - fi - - if [[ $arch == i386 ]] - then basearch=i686 - elif [[ $arch == armhfp ]] - then basearch=armv7hl - else basearch=$arch - fi - ssh $HOST /bin/bash -- << EOF - set -x - umask 002 - mock -r fedora-branched-compose-$arch --init || exit 1 - mock -r fedora-branched-compose-$arch --shell "XZ_DEFAULTS=--memlimit-compress=3700MiB pungi -c $KICKSTARTS/fedora-install-workstation.ks --destdir $DESTDIR --cachedir /srv/pungi/cache/ -B -I --no-dvd --ver $VERSION --workdirbase=/tmp/work --variant Workstation --family Fedora --installpkgs fedora-productimg-workstation" - mock -r fedora-branched-compose-$arch --shell "XZ_DEFAULTS=--memlimit-compress=3700MiB pungi -c $KICKSTARTS/fedora-install-server.ks --destdir $DESTDIR --cachedir /srv/pungi/cache/ -B -I --ver $VERSION --workdirbase=/tmp/work --variant Server --family Fedora --installpkgs fedora-productimg-server" - mock -r fedora-branched-compose-$arch --shell "XZ_DEFAULTS=--memlimit-compress=3700MiB pungi -c $KICKSTARTS/fedora-install-cloud.ks --destdir $DESTDIR --cachedir /srv/pungi/cache/ -B -I --no-dvd --ver $VERSION --workdirbase=/tmp/work --variant Cloud --family Fedora --installpkgs fedora-productimg-cloud" - mock -r fedora-branched-compose-$arch --clean || exit 1 - sg releng-team "repoclosure -a $basearch --repofrompath=$arch,$DESTDIR$VERSION/Workstation/$arch/os --repoid=$arch > $DESTDIR/logs/Workstation.$arch.repoclosure.log" - sg releng-team "repoclosure -a $basearch --repofrompath=$arch,$DESTDIR$VERSION/Server/$arch/os --repoid=$arch > $DESTDIR/logs/Server.$arch.repoclosure.log" - sg releng-team "repoclosure -a $basearch --repofrompath=$arch,$DESTDIR$VERSION/Cloud/$arch/os --repoid=$arch > $DESTDIR/logs/Cloud.$arch.repoclosure.log" -EOF - -done - -pushd $KICKSTARTS -$FULLPATH/build-cloud-images "$VERSION" "$DATE" "$BRANCH" "$COMPOSE" -popd - -hardlink -vvc $FINALDEST/$VERSION/Workstation $FINALDEST/$VERSION/Server $FINALDEST/$VERSION/Cloud - -sg releng-team "./build_composeinfo $FINALDEST/$VERSION/Workstation" -sg releng-team "./build_composeinfo $FINALDEST/$VERSION/Server" -sg releng-team "./build_composeinfo $FINALDEST/$VERSION/Cloud" -sg releng-team "./build_composeinfo $FINALDEST/$VERSION/Cloud_Atomic" - - -while true -do - if [ $(koji list-tasks --mine|grep OPEN|grep -e image -e livecd -e appliance|wc -l) -ne 0 ] - then - echo "image, appliance or livecd tasks running, waiting 2 minutes" - sleep 120 - else - break - fi -done - - -pushd $FINALDEST/$VERSION/ -sg releng-team "mkdir -p Images/armhfp Cloud_Images/x86_64/Images Spins/i386 Spins/x86_64 Live/i386 Server/armhfp/Images Live/x86_64 Docker/x86_64 Workstation/armhfp/Images Workstation/x86_64/iso Workstation/i386/iso" -popd - - -USER=$(whoami) -# stage images -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora*armhfp-$SHORTVERSION-$SHORTCOMPOSE-sda.raw.xz $FINALDEST/$VERSION/Images/armhfp/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Cloud*$VERSION-$DATE\.x86_64.raw.xz $FINALDEST/$VERSION/Cloud_Images/x86_64/Images/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Cloud*$VERSION-$DATE\.x86_64.qcow2 $FINALDEST/$VERSION/Cloud_Images/x86_64/Images/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Cloud*$VERSION-$DATE\.x86_64.*.box $FINALDEST/$VERSION/Cloud_Images/x86_64/Images/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task_*/Fedora-Docker*-$VERSION-$DATE*tar.xz $FINALDEST/$VERSION/Docker/x86_64/" - -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task*/*i686*$SHORTVERSION-$SHORTCOMPOSE.iso $FINALDEST/$VERSION/Spins/i386/" -sg releng-team "sudo /usr/bin/cp -l /mnt/fedora_koji/koji/scratch/$USER/task*/*x86_64*$SHORTVERSION-$SHORTCOMPOSE.iso $FINALDEST/$VERSION/Spins/x86_64/" - -sg releng-team "mv $FINALDEST/$VERSION/Spins/i386/Fedora-Live-Workstation* $FINALDEST/$VERSION/Workstation/i386/iso/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/i386/Fedora-Live-KDE* $FINALDEST/$VERSION/Live/i386/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/i386/Fedora-Live-Xfce* $FINALDEST/$VERSION/Live/i386/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/i386/Fedora-Live-SoaS* $FINALDEST/$VERSION/Live/i386/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/i386/Fedora-Live-LXDE* $FINALDEST/$VERSION/Live/i386/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/i386/Fedora-Live-MATE_Compiz* $FINALDEST/$VERSION/Live/i386/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/i386/Fedora-Live-Cinnamon* $FINALDEST/$VERSION/Live/i386/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/x86_64/Fedora-Live-Workstation* $FINALDEST/$VERSION/Workstation/x86_64/iso/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/x86_64/Fedora-Live-KDE* $FINALDEST/$VERSION/Live/x86_64/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/x86_64/Fedora-Live-Xfce* $FINALDEST/$VERSION/Live/x86_64/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/x86_64/Fedora-Live-SoaS* $FINALDEST/$VERSION/Live/x86_64/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/x86_64/Fedora-Live-LXDE* $FINALDEST/$VERSION/Live/x86_64/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/x86_64/Fedora-Live-MATE_Compiz* $FINALDEST/$VERSION/Live/x86_64/" -sg releng-team "mv $FINALDEST/$VERSION/Spins/x86_64/Fedora-Live-Cinnamon* $FINALDEST/$VERSION/Live/x86_64/" - -sg releng-team "mv $FINALDEST/$VERSION/Images/armhfp/Fedora-Workstation* $FINALDEST/$VERSION/Workstation/armhfp/Images/" -sg releng-team "mv $FINALDEST/$VERSION/Images/armhfp/Fedora-Server* $FINALDEST/$VERSION/Server/armhfp/Images/" - -for type in Spins Live -do -pushd $FINALDEST/$VERSION/$type/ -for arch in i386 x86_64; do pushd $arch; sg releng-team "sha256sum --tag -b *iso> Fedora-$type-$arch-$VERSION-CHECKSUM"; popd; done -popd -done - -pushd $FINALDEST/$VERSION/Cloud_Images -for arch in x86_64; do pushd $arch/Images; sg releng-team "sha256sum --tag -b *qcow2 *raw.xz *box> Fedora-Cloud_Images-$arch-$VERSION-CHECKSUM"; popd; done -popd - -pushd $FINALDEST/$VERSION/Workstation/armhfp/Images -sg releng-team "sha256sum --tag -b *raw.xz> Fedora-Workstation-Images-armhfp-$VERSION-CHECKSUM" -popd - -pushd $FINALDEST/$VERSION/Server/armhfp/Images -sg releng-team "sha256sum --tag -b *raw.xz> Fedora-Server-Images-armhfp-$VERSION-CHECKSUM" -popd - -pushd $FINALDEST/$VERSION/Docker/x86_64 -sg releng-team "sha256sum --tag -b *tar.xz> Fedora-Docker-x86_64-$VERSION-CHECKSUM" -popd - -pushd $FINALDEST/$VERSION/Workstation/ -for arch in i386 x86_64; do pushd $arch/iso/; sg releng-team "sha256sum --tag -b Fedora-Live-Workstation*iso>> Fedora-Workstation-$VERSION-$arch-CHECKSUM"; popd; done -popd - -pushd $FINALDEST/$VERSION/Images -for arch in armhfp; do pushd $arch; sg releng-team "sha256sum --tag -b *qcow2 *raw.xz> Fedora-Images-$arch-$VERSION-CHECKSUM"; popd; done -popd - -# stage the composed tree to final locateion -sg releng-team "mkdir /pub/alt/stage/$VERSION$COMPOSE/" -sg releng-team "chmod 700 /pub/alt/stage/$VERSION$COMPOSE/" -for type in Docker Workstation Server Cloud Cloud_Atomic Cloud_Images Spins Live Images; do sg releng-team "rsync -avhH $FINALDEST/$VERSION/$type/ /pub/alt/stage/$VERSION$COMPOSE/$type/"; done -#sg releng-team "chmod 755 /pub/alt/stage/$VERSION$COMPOSE/" - -echo "======= compose output for trac =======" -echo "http://dl.fedoraproject.org/pub/alt/stage/$VERSION$COMPOSE/" -echo "" -echo "armhfp Workstation repoclosure" -echo "{{{" -cat $FINALDEST/logs/Workstation.armhfp.repoclosure.log -echo "}}}" -echo "i386 Workstation repoclosure" -echo "{{{" -cat $FINALDEST/logs/Workstation.i386.repoclosure.log -echo "}}}" -echo "x86_64 Workstation repoclosure" -echo "{{{" -cat $FINALDEST/logs/Workstation.x86_64.repoclosure.log -echo "}}}" -echo "" -echo "armhfp Server repoclosure" -echo "{{{" -cat $FINALDEST/logs/Server.armhfp.repoclosure.log -echo "}}}" -echo "i386 Server repoclosure" -echo "{{{" -cat $FINALDEST/logs/Server.i386.repoclosure.log -echo "}}}" -echo "x86_64 Server repoclosure" -echo "{{{" -cat $FINALDEST/logs/Server.x86_64.repoclosure.log -echo "}}}" -echo "" -echo "armhfp Cloud repoclosure" -echo "{{{" -cat $FINALDEST/logs/Cloud.armhfp.repoclosure.log -echo "}}}" -echo "i386 Cloud repoclosure" -echo "{{{" -cat $FINALDEST/logs/Cloud.i386.repoclosure.log -echo "}}}" -echo "x86_64 Cloud repoclosure" -echo "{{{" -cat $FINALDEST/logs/Cloud.x86_64.repoclosure.log -echo "}}}"