Beispiel #1
0
    def test_getters(self):
        action = PlumberyActionLoader.from_shelf('dummy', {'dummy': 'ok'})
        self.assertEqual(action.get_type(), 'dummy')
        self.assertEqual(action.get_parameter('dummy'), 'ok')

        parameters = PlumberyParameters({'goofy': 'ok'})
        action = PlumberyActionLoader.from_shelf('dummy', parameters)
        self.assertEqual(action.get_type(), 'dummy')
        self.assertEqual(action.get_parameter('goofy'), 'ok')
    def test_getters(self):
        action = PlumberyActionLoader.from_shelf('dummy', {'dummy': 'ok'})
        self.assertEqual(action.get_type(), 'dummy')
        self.assertEqual(action.get_parameter('dummy'), 'ok')

        parameters = PlumberyParameters({'goofy': 'ok'})
        action = PlumberyActionLoader.from_shelf('dummy', parameters)
        self.assertEqual(action.get_type(), 'dummy')
        self.assertEqual(action.get_parameter('goofy'), 'ok')
    def process_all_blueprints(self, action):
        """
        Handles all blueprints at this facility

        :param action: the action to perform, e.g., 'start'
        :type action: ``str`` or :class:`plumbery.PlumberyAction`

        """

        if isinstance(action, str):
            action = PlumberyActionLoader.from_shelf(action)

        self.power_on()
        action.enter(self)

        basement = self.list_basement()
        for name in basement:
            blueprint = self.get_blueprint(name)
            action.handle(blueprint)

        for name in self.expand_blueprint('*'):
            if name not in basement:
                blueprint = self.get_blueprint(name)
                action.handle(blueprint)

        action.quit()
Beispiel #4
0
    def process_all_blueprints(self, action):
        """
        Handles all blueprints at this facility

        :param action: the action to perform, e.g., 'start'
        :type action: ``str`` or :class:`plumbery.PlumberyAction`

        """

        if isinstance(action, str):
            action = PlumberyActionLoader.from_shelf(action)

        self.power_on()
        action.enter(self)

        basement = self.list_basement()
        for name in basement:
            blueprint = self.get_blueprint(name)
            action.handle(blueprint)

        for name in self.expand_blueprint('*'):
            if name not in basement:
                blueprint = self.get_blueprint(name)
                action.handle(blueprint)

        action.quit()
Beispiel #5
0
    def test_loader_ok(self):

        action = PlumberyActionLoader.from_shelf('dummy')
        action.ignite(engine=None)
        action.enter(facility=None)
        action.handle(blueprint=None)
        action.handle(blueprint=None)
        action.quit()
        action.enter(facility=None)
        action.handle(blueprint=None)
        action.handle(blueprint=None)
        action.quit()
        action.enter(facility=None)
        action.handle(blueprint=None)
        action.handle(blueprint=None)
        action.quit()
        action.reap()
    def test_loader_ok(self):

        action = PlumberyActionLoader.from_shelf('dummy')
        action.ignite(engine=None)
        action.enter(facility=None)
        action.handle(blueprint=None)
        action.handle(blueprint=None)
        action.quit()
        action.enter(facility=None)
        action.handle(blueprint=None)
        action.handle(blueprint=None)
        action.quit()
        action.enter(facility=None)
        action.handle(blueprint=None)
        action.handle(blueprint=None)
        action.quit()
        action.reap()
    def process_blueprint(self, action, names):
        """
        Handles one blueprint at this facility

        :param action: the action to perform, e.g., 'start'
        :type action: ``str`` or :class:`plumbery.PlumberyAction`

        :param names: the name(s) of the targeted blueprint(s)
        :type names: ``str`` or ``list`` of ``str``

        """

        if isinstance(action, str):
            action = PlumberyActionLoader.from_shelf(action)

        self.power_on()
        action.enter(self)

        for name in self.expand_blueprint(names):

            blueprint = self.get_blueprint(name)
            action.handle(blueprint)

        action.quit()
Beispiel #8
0
    def process_blueprint(self, action, names):
        """
        Handles one blueprint at this facility

        :param action: the action to perform, e.g., 'start'
        :type action: ``str`` or :class:`plumbery.PlumberyAction`

        :param names: the name(s) of the targeted blueprint(s)
        :type names: ``str`` or ``list`` of ``str``

        """

        if isinstance(action, str):
            action = PlumberyActionLoader.from_shelf(action)

        self.power_on()
        action.enter(self)

        for name in self.expand_blueprint(names):

            blueprint = self.get_blueprint(name)
            action.handle(blueprint)

        action.quit()
Beispiel #9
0
    def test_loader_unknown_class(self):

        with self.assertRaises(ImportError):
            action = PlumberyActionLoader.from_shelf('*123*')
    def test_loader_unknown_class(self):

        with self.assertRaises(ImportError):
            action = PlumberyActionLoader.from_shelf('*123*')