Ejemplo n.º 1
0
 def setUp(self):
     self.nulecule_base = Nulecule_Base(dryrun=True)
     self.tmpdir = tempfile.mkdtemp(prefix="atomicapp-test", dir="/tmp")
     self.artifact_dir = os.path.dirname(
         __file__) + '/docker_artifact_test/'
     self.plugin = Plugin()
     self.plugin.load_plugins()
Ejemplo n.º 2
0
    def __init__(self, config, basepath, graph, provider, dryrun):
        self.plugin = Plugin()

        self.config = config
        self.basepath = basepath
        self.graph = graph
        self.dryrun = dryrun

        # We initialize the provider in order to gather provider-specific
        # information
        p = self.plugin.getProvider(provider)
        self.provider = p(config, basepath, dryrun)
        self.provider.init()
Ejemplo n.º 3
0
    def test_getProvider(self):
        """
        Test if getProvider is returning appropriate classes to the
        corresponding keys.
        """
        p = Plugin()

        docker_mock = mock.Mock()
        kubernetes_mock = mock.Mock()
        # keep some mock objects in place of the actual corresponding
        # classes, getProvider reads from `plugins` dict.
        p.plugins = {
            'docker': docker_mock,
            'kubernetes': kubernetes_mock,
        }
        self.assertEqual(p.getProvider('docker'), docker_mock)
        self.assertEqual(p.getProvider('kubernetes'), kubernetes_mock)
        # if non-existent key provided
        self.assertEqual(p.getProvider('some_random'), None)
Ejemplo n.º 4
0
# -*- coding: utf-8 -*-
from atomicapp.constants import (GLOBAL_CONF, DEFAULT_PROVIDER,
                                 DEFAULT_ANSWERS)
from atomicapp.utils import Utils
from atomicapp.plugin import Plugin

plugin = Plugin()
plugin.load_plugins()


class NuleculeBase(object):
    """
    This is the base class for Nulecule and NuleculeComponent in
    atomicapp.nulecule.base.
    """
    def __init__(self, basepath, params, namespace):
        self.basepath = basepath
        self.params = params or []
        self.namespace = namespace

    def load(self):
        pass

    def load_config(self, config=None, ask=False, skip_asking=False):
        """
        Load config data. Sets the loaded config data to self.config.

        Args:
            config (dict): Initial config data
            ask (bool): When True, ask for values for a param from user even
                        if the param has a default value
Ejemplo n.º 5
0
 def __init__(self, basepath, params, namespace):
     self.plugin = Plugin()
     self.plugin.load_plugins()
     self.basepath = basepath
     self.params = params or []
     self.namespace = namespace
Ejemplo n.º 6
0
 def setUp(self):
     self.nulecule_base = Nulecule_Base(dryrun=True)
     self.tmpdir = tempfile.mkdtemp(prefix="atomicapp-test", dir="/tmp")
     self.plugin = Plugin()
     self.plugin.load_plugins()