Ejemplo n.º 1
0
    def exec_module(self):
        if not module_provisioned(self.client, 'gtm'):
            raise F5ModuleError("GTM must be provisioned to use this module.")
        wants = None
        if self.module.params['replace_all_with']:
            self.replace_all_with = True

        if self.module.params['aggregate']:
            wants = self.merge_defaults_for_aggregate(self.module.params)

        result = dict()
        changed = False

        if self.replace_all_with and self.purge_links:
            self.purge()
            changed = True

        if self.module.params['aggregate']:
            result['aggregate'] = list()
            for want in wants:
                output = self.execute(want)
                if output['changed']:
                    changed = output['changed']
                result['aggregate'].append(output)
        else:
            output = self.execute(self.module.params)
            if output['changed']:
                changed = output['changed']
            result.update(output)
        if changed:
            result['changed'] = True
        return result
    def exec_module(self):
        if not module_provisioned(self.client, 'asm'):
            raise F5ModuleError(
                "ASM must be provisioned to use this module."
            )
        if self.version_is_less_than_13():
            raise F5ModuleError(
                "This module requires TMOS version 13.x and above."
            )

        changed = False
        result = dict()
        state = self.want.state

        if state == "present":
            changed = self.present()
        elif state == "absent":
            changed = self.absent()

        reportable = ReportableChanges(params=self.changes.to_return())
        changes = reportable.to_return()
        result.update(**changes)
        result.update(dict(changed=changed))
        self._announce_deprecations(result)
        return result
 def exec_module(self):
     if not module_provisioned(self.client, 'gtm'):
         raise F5ModuleError("GTM must be provisioned to use this module.")
     if self.version_is_less_than_12():
         manager = self.get_manager('untyped')
     else:
         manager = self.get_manager('typed')
     return manager.exec_module()
 def exec_module(self):
     if not module_provisioned(self.client, 'asm'):
         raise F5ModuleError("ASM must be provisioned to use this module.")
     if self.version_is_less_than_13():
         manager = self.get_manager('v1')
     else:
         manager = self.get_manager('v2')
     return manager.exec_module()
 def create(self):
     self._set_changed_options()
     if self.want.port_misuse_policy:
         if not module_provisioned(self.client, 'afm'):
             raise F5ModuleError(
                 "To configure a 'port_misuse_policy', you must have AFM provisioned."
             )
     if self.module.check_mode:
         return True
     self.create_on_device()
     return True
    def exec_module(self):
        if not module_provisioned(self.client, 'asm'):
            raise F5ModuleError("ASM must be provisioned to use this module.")
        result = dict()

        self.export()

        reportable = ReportableChanges(params=self.changes.to_return())
        changes = reportable.to_return()
        result.update(**changes)
        result.update(dict(changed=True))
        return result
Ejemplo n.º 7
0
    def exec_module(self):  # lgtm [py/similar-function]
        if not module_provisioned(self.client, 'gtm'):
            raise F5ModuleError("GTM must be provisioned to use this module.")
        result = dict()

        changed = self.present()

        reportable = ReportableChanges(params=self.changes.to_return())
        changes = reportable.to_return()
        result.update(**changes)
        result.update(dict(changed=changed))
        self._announce_deprecations(result)
        return result
 def update(self):
     self.have = self.read_current_from_device()
     if not self.should_update():
         return False
     if self.want.port_misuse_policy:
         if not module_provisioned(self.client, 'afm'):
             raise F5ModuleError(
                 "To configure a 'port_misuse_policy', you must have AFM provisioned."
             )
     if self.module.check_mode:
         return True
     self.update_on_device()
     return True
    def exec_module(self):
        if not module_provisioned(self.client, 'asm'):
            raise F5ModuleError("ASM must be provisioned to use this module.")

        result = dict()

        changed = self.policy_import()

        reportable = ReportableChanges(params=self.changes.to_return())
        changes = reportable.to_return()
        result.update(**changes)
        result.update(dict(changed=changed))
        self._announce_deprecations(result)
        return result
Ejemplo n.º 10
0
    def exec_module(self):
        if not module_provisioned(self.client, 'gtm'):
            raise F5ModuleError("GTM must be provisioned to use this module.")
        changed = False
        result = dict()
        state = self.want.state

        if state in ['present', 'enabled', 'disabled']:
            changed = self.present()
        elif state == "absent":
            changed = self.absent()

        reportable = ReportableChanges(params=self.changes.to_return())
        changes = reportable.to_return()
        result.update(**changes)
        result.update(dict(changed=changed))
        self._announce_deprecations(result)
        return result
Ejemplo n.º 11
0
    def exec_module(self):
        if not module_provisioned(self.client, 'apm'):
            raise F5ModuleError("APM must be provisioned to use this module.")

        if self.version_less_than_14():
            raise F5ModuleError(
                'Due to bug ID685681 it is not possible to use this module on TMOS version below 14.x'
            )

        result = dict()

        self.export()

        reportable = ReportableChanges(params=self.changes.to_return())
        changes = reportable.to_return()
        result.update(**changes)
        result.update(dict(changed=True))
        return result