Пример #1
0
    def execute_module_stream_action(self, entity_name, action_type, module_name, stream_version,
                                     customize=False, customize_values=None):
        """Execute remote module_stream action on a content

        :param entity_name: content host name
        :param action_type: remote action to execute on content host. Action value can be one of
            them e.g. 'Enable', 'Disable', 'Install', 'Update', 'Remove', 'Reset'
        :param module_name: Module Stream name to remotely
            install/upgrade/remove (depending on `action_type`)
        :param stream_version: String with Stream Version of Module
        :param customize: Boolean indicating if additional custom action should be called
        :param customize_values: Dict with custom actions to run. Mandatory if customize is True

        :return: Returns a dict containing job status details
        """
        if customize_values is None:
            customize_values = {}
        view = self.navigate_to(self, 'Edit', entity_name=entity_name)
        view.module_streams.search('name = {} and stream = {}'.format(module_name, stream_version))
        action_type = dict(is_customize=customize, action=action_type)
        view.module_streams.table.row(
            name=module_name, stream=stream_version)['Actions'].fill(action_type)
        if customize:
            view = JobInvocationCreateView(view.browser)
            view.fill(customize_values)
            view.submit.click()
        view = JobInvocationStatusView(view.browser)
        view.wait_for_result()
        return view.read()
Пример #2
0
    def run_playbook(self,
                     entity_name,
                     customize=False,
                     customize_values=None):
        """Run Ansible playbook associated with given plan

        :param str entity_name: Name of plan
        :param bool customize: Whether remote job should be customized first
        :param dict customize_values: Values to fill on customize remote job
            screen
        """
        action_name = 'Run Playbook'
        if customize:
            action_name = 'Customize Playbook Run'

        view = self.navigate_to(self, "Details",
                                entity_name=entity_name).plan(entity_name)
        view.ansible_actions.fill(action_name)
        if customize:
            view = JobInvocationCreateView(self.browser)
            view.fill(customize_values)
            view.submit.click()
        view = JobInvocationStatusView(self.browser)
        view.wait_for_result()
        return view.read()