python-tripleoclient/tripleoclient/v1/container_image.py
Steve Baker efedf4bb7c New command "overcloud container image upload"
This is the container image equivalent to the "overcloud image upload"
command. It wraps tripleo-common logic which has existed for some time
now[1].

The configuration file used in CI is also in tripleo-common [2] and
the existence of this command will allow the custom python[3] to be
replaced with a simple command invocation.

The same configuration file format will be used to implement another
new command "overcloud container image build".

[1] http://git.openstack.org/cgit/openstack/tripleo-common/tree/tripleo_common/image/image_uploader.py
[2] http://git.openstack.org/cgit/openstack/tripleo-common/tree/contrib/overcloud_containers.yaml
[3] http://git.openstack.org/cgit/openstack/tripleo-quickstart-extras/tree/roles/overcloud-prep-containers/templates/upload_images_to_local_registry.py.j2

Change-Id: Id505b57698b6a15c62494764b2d9eca1933e63f1
2017-03-16 00:46:51 +00:00

48 lines
1.7 KiB
Python

# Copyright 2015 Red Hat, Inc.
#
# 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 logging
from osc_lib.command import command
from osc_lib.i18n import _
from tripleo_common.image import image_uploader
class UploadImage(command.Command):
"""Push overcloud container images to registries."""
log = logging.getLogger(__name__ + ".UploadImage")
def get_parser(self, prog_name):
parser = super(UploadImage, self).get_parser(prog_name)
parser.add_argument(
"--config-file",
dest="config_files",
metavar='<yaml config file>',
default=[],
action="append",
help=_("YAML config file specifying the image build. May be "
"specified multiple times. Order is preserved, and later "
"files will override some options in previous files. "
"Other options will append."),
)
return parser
def take_action(self, parsed_args):
self.log.debug("take_action(%s)" % parsed_args)
uploader = image_uploader.ImageUploadManager(
parsed_args.config_files)
uploader.upload()