Debian Codegraph @

ansible_collections/cisco/ios/plugins/action/ios_ospfv2.py

raw
1 #
2 # (c) 2016 Red Hat Inc.
3 #
4 # This file is part of Ansible
5 #
6 # Ansible is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Ansible is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
18 #
19 from __future__ import absolute_import, division, print_function
20
21
22 __metaclass__ = type
23
24
25 from ansible.utils.display import Display
26 from ansible_collections.ansible.netcommon.plugins.action.network import (
27 ActionModule as ActionNetworkModule,
28 )
29
30
31 display = Display()
32
33
34 class ActionModule(ActionNetworkModule):
35 def run(self, tmp=None, task_vars=None):
36 del tmp # tmp no longer has any effect
37
38 module_name = self._task.action.split(".")[-1]
39 self._config_module = True if module_name in ["ios_config", "config"] else False
40 persistent_connection = self._play_context.connection.split(".")[-1]
41
42 if persistent_connection != "network_cli":
43 return {
44 "failed": True,
45 "msg": "Connection type %s is not valid for this module"
46 % self._play_context.connection,
47 }
48
49 return super(ActionModule, self).run(task_vars=task_vars)