Skip to content

Instantly share code, notes, and snippets.

View dosaboy's full-sized avatar

Edward Hope-Morley dosaboy

View GitHub Profile
@dosaboy
dosaboy / charm-upgrade-openstack
Last active April 12, 2019 01:55
Upgrade Openstack deployed with Juju Charm
#!/bin/bash -eu
#
# Trigger a managed upgrade.
#
# Authors:
# edward.hope-morley@canonical.com
#
SERVICE=$1
RELEASE=$2
SERIES=${3:-'trusty'}
#!/bin/bash -eu
# Author:
# Edward Hope-Morley <opentastic@gmail.com>
#
# Description:
# Fetches package source and applies all debian/patches to current git
# working tree (ideally a clean branch created from associated build tag ).
#
# Each patch will be committed once applied successfully.
#
#!/bin/bash -eux
repos=(
charm-swift-storage
charm-swift-proxy
charm-rabbitmq-server
charm-percona-cluster
charm-openvswitch-odl
charm-openstack-dashboard
charm-odl-controller
charm-nova-compute
#!/bin/bash -eu
#
# From https://gist.github.com/dosaboy/24274d8de9110c4cdba4
# Fetch openstack charm patchset from review.openstack.org and store locally
#
(($#==3)) || { echo "USAGE: `basename $0` <repository-name> <gerrit-changeref> <patchset> [<ubuntu-series>]"; exit 1; }
REPO=$1
CHANGEREF=$2
PATCHSET=$3
SERIES=${4:-jammy}
#!/bin/bash -eu
#
# Build hardening.io test charm from layer
#
(($# > 0)) || { echo "USAGE: `basename $0` os|ssh|mysql|apache"; exit 1; }
set -x
mod=$1
target=charms/hardening-$mod-tests-charm
layer=layers/hardening-$mod-tests
results=/tmp/charm_build_results
#!/bin/bash -eux
PREFIX=10.6.0.0
ROUTER=
NUMNETS=1 # number if networks/interfaces to add per unit
while (($#)); do
case "$1" in
-s|--service)
SERVICE="$2"
shift
#!/bin/bash -eux
read -a instances<<<`nova list --all-tenants| grep -Ev "$\+\-\-+|\sID\s"| awk '{print $2}'| sed '/^$/d'`
echo ${#instances[@]} instances to be deleted
for vm in ${instances[@]}; do
echo "Deleting instance $vm"
#nova delete $vm && continue
read -p "Soft delete instance failed. Try hard delete? [Y,n] " answer
if [ -z "$answer" ] || [ ${answer,,} = "y" ]; then
#nova force-delete $vm
:
#!/bin/bash -eux
#
# Get debian source for a package.
#
PKG=$1 # package name
UREL=$2 # ubuntu release name
VER=`rmadison $PKG| awk "\\$5==\"$UREL\" {print \\$3}"`
URL="https://launchpad.net/ubuntu/+archive/primary/+files/${PKG}_$VER.dsc"
dget $URL
@dosaboy
dosaboy / s3test.py
Last active February 4, 2019 12:37
#!/usr/bin/env python2
"""
Origin: https://gist.github.com/dosaboy/6cf5ef71f2cfe39ba60c08f7010d9d5c
Authors:
- edward.hope-morley@canonical.com
- opentastic@gmail.com
Description:
S3 API test tool. Can be used to test S3 api as provided by
#!/bin/bash -eu
(($# >= 2)) || { echo "USAGE: `basename $0` <pkg_ver> <lp_bug> [<build_id>]"; exit 1; }
pkg_ver=$1
lp_bug=$2
build_id="${3:-0}"
echo ${pkg_ver}+hf${lp_bug}v`date +%Y%m%d`.$build_id