Ejemplo n.º 1
0
    def build(self):
        """Build Docker image from ImageInfo object using atomic_reactor. Set ImageInfo
        object `built` and `build_result` attributes.

        :return: atomic_reactor's BuildResults object
        """
        tag = self.tag or self.image_info.name_str()
        df_dir = os.path.join(self.image_info.vcs_local_path, self.image_info.vcs_image_buildfile)
        df_dir = os.path.dirname(df_dir)
        target_registries = [self.registry] if self.registry else None

        # atomic_reactor's logging during build isn't really useful, send it to logfile only
        atomic_reactor.set_logging(level=logging.DEBUG, handler=atomicapp_builder.file_handler)
        logger.info('Building image %s ...', tag)
        response = arapi.build_image_using_hosts_docker(
            self.build_image,
            {'provider': 'path', 'uri': 'file://' + df_dir},
            tag,
            target_registries=target_registries,
            target_registries_insecure=self.registry_insecure
        )
        self.image_info.build_result = response
        if response.return_code == 0:
            self.image_info.built = True
        return self.image_info.built
Ejemplo n.º 2
0
    def __init__(self, workflow, pulp_instance, filename, log, pulp_secret_path=None, username=None,
                 password=None):
        self.workflow = workflow
        self.pulp_instance = pulp_instance
        self.filename = filename
        self.pulp_secret_path = pulp_secret_path
        self.log = log
        # U/N & password has bigger prio than secret cert
        self.username = username
        self.password = password

        set_logging("dockpulp")
Ejemplo n.º 3
0
    def __init__(self, workflow, pulp_instance, filename, log, pulp_secret_path=None, username=None,
                 password=None):
        self.workflow = workflow
        self.pulp_instance = pulp_instance
        self.filename = filename
        self.pulp_secret_path = pulp_secret_path
        self.log = log
        # U/N & password has bigger prio than secret cert
        self.username = username
        self.password = password

        set_logging("dockpulp")
Ejemplo n.º 4
0
    def run(self):
        self.set_arguments()
        args = self.parser.parse_args()
        logging.captureWarnings(True)

        if args.verbose:
            set_logging(level=logging.DEBUG)
        elif args.quiet:
            set_logging(level=logging.WARNING)
        else:
            set_logging(level=logging.INFO)
        try:
            args.func(args)
        except AttributeError:
            if hasattr(args, 'func'):
                raise
            else:
                self.parser.print_help()
        except KeyboardInterrupt:
            pass
        except Exception as ex:
            if args.verbose:
                raise
            else:
                logger.error("exception caught: %r", ex)
Ejemplo n.º 5
0
    def run(self):
        self.set_arguments()
        args = self.parser.parse_args()
        logging.captureWarnings(True)

        if args.verbose:
            set_logging(level=logging.DEBUG)
        elif args.quiet:
            set_logging(level=logging.WARNING)
        else:
            set_logging(level=logging.INFO)
        try:
            args.func(args)
        except AttributeError:
            if hasattr(args, 'func'):
                raise
            else:
                self.parser.print_help()
        except KeyboardInterrupt:
            pass
        except Exception as ex:
            if args.verbose:
                raise
            else:
                logger.error("exception caught: %r", ex)
Ejemplo n.º 6
0
def _process_global_args(args: dict) -> dict:
    """Process global arguments, return non-global arguments (task arguments)."""
    task_args = args.copy()

    verbose = task_args.pop("verbose")
    quiet = task_args.pop("quiet")
    # Note: the version argument is not stored by argparse (because it has the 'version' action)

    if verbose:
        atomic_reactor.set_logging(level=logging.DEBUG)
        osbs.set_logging(level=logging.DEBUG)
    elif quiet:
        atomic_reactor.set_logging(level=logging.WARNING)
        osbs.set_logging(level=logging.WARNING)
    else:
        atomic_reactor.set_logging(level=logging.INFO)
        osbs.set_logging(level=logging.INFO)

    return task_args
Ejemplo n.º 7
0
"""
Copyright (c) 2015 Red Hat, Inc
All rights reserved.

This software may be modified and distributed under the terms
of the BSD license. See the LICENSE file for details.
"""

from __future__ import absolute_import

from atomic_reactor import set_logging

set_logging(name="atomic_reactor.tests")
set_logging(name="atomic_reactor")