Add actions and functional test definitions/bundles
This commit is contained in:
17
src/actions.yaml
Normal file
17
src/actions.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
retrofit-image:
|
||||
description: |
|
||||
Trigger image retrofitting process
|
||||
params:
|
||||
source-image:
|
||||
type: string
|
||||
default: ''
|
||||
description: |
|
||||
Optionally specify ID of image in Glance to use as source for the
|
||||
retrofitting. The default is to automatically select the most
|
||||
recent Ubuntu Server or Minimal daily Cloud image.
|
||||
force:
|
||||
type: boolean
|
||||
default: False
|
||||
description: |
|
||||
Force re-retrofitting image despite presence of apparently up to
|
||||
date target image.
|
||||
70
src/actions/actions.py
Executable file
70
src/actions/actions.py
Executable file
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env python3
|
||||
# Copyright 2019 Canonical Ltd
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
# Load basic layer module from $CHARM_DIR/lib
|
||||
sys.path.append('lib')
|
||||
from charms.layer import basic
|
||||
|
||||
# setup module loading from charm venv
|
||||
basic.bootstrap_charm_deps()
|
||||
|
||||
import charms.reactive as reactive
|
||||
import charmhelpers.core as ch_core
|
||||
import charms_openstack.bus
|
||||
import charms_openstack.charm as charm
|
||||
|
||||
# load reactive interfaces
|
||||
reactive.bus.discover()
|
||||
# load Endpoint based interface data
|
||||
ch_core.hookenv._run_atstart()
|
||||
|
||||
# load charm class
|
||||
charms_openstack.bus.discover()
|
||||
|
||||
|
||||
def retrofit_image(*args):
|
||||
"""Trigger image retrofitting process."""
|
||||
keystone_endpoint = reactive.endpoint_from_flag(
|
||||
'identity-credentials.available')
|
||||
with charm.provide_charm_instance() as instance:
|
||||
instance.retrofit(
|
||||
keystone_endpoint,
|
||||
ch_core.hookenv.action_get('force'),
|
||||
ch_core.hookenv.action_get('source-image'))
|
||||
|
||||
|
||||
ACTIONS = {
|
||||
'retrofit-image': retrofit_image,
|
||||
}
|
||||
|
||||
|
||||
def main(args):
|
||||
action_name = os.path.basename(args[0])
|
||||
try:
|
||||
action = ACTIONS[action_name]
|
||||
except KeyError:
|
||||
return 'Action {} is undefined'.format(action_name)
|
||||
|
||||
try:
|
||||
action(args)
|
||||
except Exception as e:
|
||||
ch_core.hookenv.action_fail(str(e))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(main(sys.argv))
|
||||
1
src/actions/retrofit-image
Symbolic link
1
src/actions/retrofit-image
Symbolic link
@@ -0,0 +1 @@
|
||||
actions.py
|
||||
67
src/tests/bundles/bionic-stein.yaml
Normal file
67
src/tests/bundles/bionic-stein.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
series: bionic
|
||||
relations:
|
||||
- - glance-simplestreams-sync:juju-info
|
||||
- octavia-diskimage-retrofit:juju-info
|
||||
- - mysql:shared-db
|
||||
- keystone:shared-db
|
||||
- - mysql:shared-db
|
||||
- glance:shared-db
|
||||
- - keystone:identity-service
|
||||
- glance:identity-service
|
||||
- - keystone:identity-service
|
||||
- glance-simplestreams-sync:identity-service
|
||||
- - glance:amqp
|
||||
- rabbitmq-server:amqp
|
||||
- - rabbitmq-server:amqp
|
||||
- glance-simplestreams-sync:amqp
|
||||
- - keystone:identity-credentials
|
||||
- octavia-diskimage-retrofit:identity-credentials
|
||||
applications:
|
||||
keystone:
|
||||
charm: cs:~openstack-charmers-next/keystone
|
||||
num_units: 1
|
||||
options:
|
||||
openstack-origin: cloud:bionic-stein
|
||||
mysql:
|
||||
constraints: mem=3072M
|
||||
charm: cs:~openstack-charmers-next/percona-cluster
|
||||
num_units: 1
|
||||
rabbitmq-server:
|
||||
charm: cs:~openstack-charmers-next/rabbitmq-server
|
||||
num_units: 1
|
||||
glance:
|
||||
charm: cs:~openstack-charmers-next/glance
|
||||
num_units: 1
|
||||
options:
|
||||
openstack-origin: cloud:bionic-stein
|
||||
glance-simplestreams-sync:
|
||||
charm: cs:~openstack-charmers-next/glance-simplestreams-sync
|
||||
num_units: 1
|
||||
options:
|
||||
source: ppa:simplestreams-dev/trunk
|
||||
use_swift: False
|
||||
mirror_list: "[{url: 'http://cloud-images.ubuntu.com/daily/',
|
||||
name_prefix: 'ubuntu:released',
|
||||
path: 'streams/v1/index.sjson',
|
||||
max: 1,
|
||||
item_filters: [
|
||||
'release~(xenial|bionic|eoan)',
|
||||
'arch~(x86_64|amd64)',
|
||||
'ftype~(disk1.img|disk.img)'
|
||||
]
|
||||
},
|
||||
{url: 'http://cloud-images.ubuntu.com/minimal/daily/',
|
||||
name_prefix: 'ubuntu:released',
|
||||
path: 'streams/v1/index.sjson',
|
||||
max: 1,
|
||||
item_filters: [
|
||||
'release~(xenial|bionic|eoan)',
|
||||
'arch~(x86_64|amd64)',
|
||||
'ftype~(disk1.img|disk.img)'
|
||||
]
|
||||
}]"
|
||||
octavia-diskimage-retrofit:
|
||||
series: bionic
|
||||
charm: ../../../octavia-diskimage-retrofit
|
||||
options:
|
||||
retrofit-uca-pocket: stein
|
||||
65
src/tests/bundles/disco.yaml
Normal file
65
src/tests/bundles/disco.yaml
Normal file
@@ -0,0 +1,65 @@
|
||||
series: disco
|
||||
relations:
|
||||
- - glance-simplestreams-sync:juju-info
|
||||
- octavia-diskimage-retrofit:juju-info
|
||||
- - mysql:shared-db
|
||||
- keystone:shared-db
|
||||
- - mysql:shared-db
|
||||
- glance:shared-db
|
||||
- - keystone:identity-service
|
||||
- glance:identity-service
|
||||
- - keystone:identity-service
|
||||
- glance-simplestreams-sync:identity-service
|
||||
- - glance:amqp
|
||||
- rabbitmq-server:amqp
|
||||
- - rabbitmq-server:amqp
|
||||
- glance-simplestreams-sync:amqp
|
||||
- - keystone:identity-credentials
|
||||
- octavia-diskimage-retrofit:identity-credentials
|
||||
applications:
|
||||
keystone:
|
||||
charm: cs:~openstack-charmers-next/keystone
|
||||
num_units: 1
|
||||
options:
|
||||
openstack-origin: distro
|
||||
mysql:
|
||||
constraints: mem=3072M
|
||||
charm: cs:~openstack-charmers-next/percona-cluster
|
||||
num_units: 1
|
||||
rabbitmq-server:
|
||||
charm: cs:~openstack-charmers-next/rabbitmq-server
|
||||
num_units: 1
|
||||
glance:
|
||||
charm: cs:~openstack-charmers-next/glance
|
||||
num_units: 1
|
||||
options:
|
||||
openstack-origin: distro
|
||||
glance-simplestreams-sync:
|
||||
charm: cs:~openstack-charmers-next/glance-simplestreams-sync
|
||||
num_units: 1
|
||||
options:
|
||||
source: ppa:simplestreams-dev/trunk
|
||||
use_swift: False
|
||||
mirror_list: "[{url: 'http://cloud-images.ubuntu.com/daily/',
|
||||
name_prefix: 'ubuntu:released',
|
||||
path: 'streams/v1/index.sjson',
|
||||
max: 1,
|
||||
item_filters: [
|
||||
'release~(xenial|bionic|eoan)',
|
||||
'arch~(x86_64|amd64)',
|
||||
'ftype~(disk1.img|disk.img)'
|
||||
]
|
||||
},
|
||||
{url: 'http://cloud-images.ubuntu.com/minimal/daily/',
|
||||
name_prefix: 'ubuntu:released',
|
||||
path: 'streams/v1/index.sjson',
|
||||
max: 1,
|
||||
item_filters: [
|
||||
'release~(xenial|bionic|eoan)',
|
||||
'arch~(x86_64|amd64)',
|
||||
'ftype~(disk1.img|disk.img)'
|
||||
]
|
||||
}]"
|
||||
octavia-diskimage-retrofit:
|
||||
series: disco
|
||||
charm: ../../../octavia-diskimage-retrofit
|
||||
65
src/tests/bundles/eoan.yaml
Normal file
65
src/tests/bundles/eoan.yaml
Normal file
@@ -0,0 +1,65 @@
|
||||
series: eoan
|
||||
relations:
|
||||
- - glance-simplestreams-sync:juju-info
|
||||
- octavia-diskimage-retrofit:juju-info
|
||||
- - mysql:shared-db
|
||||
- keystone:shared-db
|
||||
- - mysql:shared-db
|
||||
- glance:shared-db
|
||||
- - keystone:identity-service
|
||||
- glance:identity-service
|
||||
- - keystone:identity-service
|
||||
- glance-simplestreams-sync:identity-service
|
||||
- - glance:amqp
|
||||
- rabbitmq-server:amqp
|
||||
- - rabbitmq-server:amqp
|
||||
- glance-simplestreams-sync:amqp
|
||||
- - keystone:identity-credentials
|
||||
- octavia-diskimage-retrofit:identity-credentials
|
||||
applications:
|
||||
keystone:
|
||||
charm: cs:~openstack-charmers-next/keystone
|
||||
num_units: 1
|
||||
options:
|
||||
openstack-origin: distro
|
||||
mysql:
|
||||
constraints: mem=3072M
|
||||
charm: cs:~openstack-charmers-next/percona-cluster
|
||||
num_units: 1
|
||||
rabbitmq-server:
|
||||
charm: cs:~openstack-charmers-next/rabbitmq-server
|
||||
num_units: 1
|
||||
glance:
|
||||
charm: cs:~openstack-charmers-next/glance
|
||||
num_units: 1
|
||||
options:
|
||||
openstack-origin: distro
|
||||
glance-simplestreams-sync:
|
||||
charm: cs:~openstack-charmers-next/glance-simplestreams-sync
|
||||
num_units: 1
|
||||
options:
|
||||
source: ppa:simplestreams-dev/trunk
|
||||
use_swift: False
|
||||
mirror_list: "[{url: 'http://cloud-images.ubuntu.com/daily/',
|
||||
name_prefix: 'ubuntu:released',
|
||||
path: 'streams/v1/index.sjson',
|
||||
max: 1,
|
||||
item_filters: [
|
||||
'release~(xenial|bionic|eoan)',
|
||||
'arch~(x86_64|amd64)',
|
||||
'ftype~(disk1.img|disk.img)'
|
||||
]
|
||||
},
|
||||
{url: 'http://cloud-images.ubuntu.com/minimal/daily/',
|
||||
name_prefix: 'ubuntu:released',
|
||||
path: 'streams/v1/index.sjson',
|
||||
max: 1,
|
||||
item_filters: [
|
||||
'release~(xenial|bionic|eoan)',
|
||||
'arch~(x86_64|amd64)',
|
||||
'ftype~(disk1.img|disk.img)'
|
||||
]
|
||||
}]"
|
||||
octavia-diskimage-retrofit:
|
||||
series: eoan
|
||||
charm: ../../../octavia-diskimage-retrofit
|
||||
@@ -1,11 +1,15 @@
|
||||
charm_name: octavia-diskimage-retrofit
|
||||
smoke_bundles:
|
||||
- bionic-rocky
|
||||
gate_bundles:
|
||||
- bionic-rocky
|
||||
- bionic-stein
|
||||
- disco
|
||||
dev_bundles:
|
||||
- eoan
|
||||
target_deploy_status:
|
||||
glance-simplestreams-sync:
|
||||
workload-status: active
|
||||
workload-status-message: Sync completed
|
||||
configure:
|
||||
- zaza.charm_tests.noop.setup.basic_setup
|
||||
tests:
|
||||
- zaza.charm_tests.noop.tests.NoopTest
|
||||
- zaza.openstack.charm_tests.octavia.diskimage_retrofit.tests.OctaviaDiskimageRetrofitTest
|
||||
|
||||
Reference in New Issue
Block a user