File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+ # Share images from one project to another
3+ #
4+ # usage:
5+ # share-images SOURCE_PROJECT DEST_PROJECT IMAGE_NAME
6+ #
7+ # NB: This requires a clouds.yaml file which uses project names as cloud keys
8+
9+ set -euo pipefail
10+
11+ SOURCE=$1
12+ DEST=$2
13+ IMAGE_NAME=$3
14+
15+ export OS_CLOUD=$SOURCE
16+ SOURCE_PROJECT=$( openstack project show -c id -f value $SOURCE )
17+ export OS_CLOUD=$DEST
18+ DEST_PROJECT=$( openstack project show -c id -f value $DEST )
19+ export OS_CLOUD=$SOURCE
20+ IMAGE=$( openstack image show -c id -f value $IMAGE_NAME )
21+
22+ echo " Sharing $IMAGE_NAME ($IMAGE ) from $SOURCE ($SOURCE_PROJECT ) ..."
23+ openstack image set --shared $IMAGE
24+ echo " Adding destination project $DEST ($DEST_PROJECT ) ..."
25+ openstack image add project $IMAGE $DEST_PROJECT
26+
27+ export OS_CLOUD=$DEST
28+ echo " Accepting share ..."
29+ openstack image set --accept $IMAGE
30+ echo " Done"
You can’t perform that action at this time.
0 commit comments