Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved pythonlibs to module_utils to avoid usage of ENV vars #20

Merged
merged 2 commits into from
Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions library/mt_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
password: 123
'''

import mt_api
from mt_common import clean_params
from ansible.module_utils import mt_api
from ansible.module_utils.mt_common import clean_params
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_dhcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
dns: 192.168.1.20
'''

from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_hotspot.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
use-radius: yes
'''

from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule


Expand Down
4 changes: 2 additions & 2 deletions library/mt_interface_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
comment: ansible_test
'''

import mt_api
from mt_common import clean_params
from ansible.module_utils import mt_api
from ansible.module_utils.mt_common import clean_params
from ansible.module_utils.basic import AnsibleModule


Expand Down
4 changes: 2 additions & 2 deletions library/mt_interface_bridge_port.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@
comment: ansible_test
'''

import mt_api
from mt_common import clean_params
from ansible.module_utils import mt_api
from ansible.module_utils.mt_common import clean_params
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_interface_wireless.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
'''

from ansible.module_utils.basic import AnsibleModule
from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent


def main():
Expand Down
2 changes: 1 addition & 1 deletion library/mt_interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
mtu: 1501
'''

from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_ip.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
'''

from ansible.module_utils.basic import AnsibleModule
from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent


def main():
Expand Down
2 changes: 1 addition & 1 deletion library/mt_ip_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
comment: "link 3"
'''

import mt_api
from ansible.module_utils import mt_api
import socket

#import mt_action #TODO: get this working
Expand Down
4 changes: 2 additions & 2 deletions library/mt_ip_firewall.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@
password: "{{ mt_pass }}"
state: present
parameter: filter
settings:
rule:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this a fix or a potential improvement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That change was included by mistake as it should not be part of the PR. This change is because the modules is not using "settings" but "rule" as the dictionary that contains the elements to be added/removed to the module. This should be part of another PR for issue #14

action: accept
chain: forward
comment: controlled by ansible
place-before: "2"
'''

from ansible.module_utils.basic import AnsibleModule
import mt_api
from ansible.module_utils import mt_api
import re
from copy import copy

Expand Down
2 changes: 1 addition & 1 deletion library/mt_ip_firewall_addresslist.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
- 19.134.52.23/23
'''

import mt_api
from ansible.module_utils import mt_api
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_login_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#! /usr/bin/python

import json
import mt_api
from ansible.module_utils import mt_api

from ansible.module_utils.basic import AnsibleModule

Expand Down
2 changes: 1 addition & 1 deletion library/mt_neighbor.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
discover: "yes"
'''

from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_radius.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
'''

from ansible.module_utils.basic import AnsibleModule
from mt_common import MikrotikIdempotent
from ansible.module_utils.mt_common import MikrotikIdempotent


def main():
Expand Down
2 changes: 1 addition & 1 deletion library/mt_radius_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
timeout: '2s500ms'
'''

import mt_api
from ansible.module_utils import mt_api
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_snmp.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
name: ansible_managed
'''

from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
name: test_ansible
'''

from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule


Expand Down
4 changes: 2 additions & 2 deletions library/mt_system_scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@
on_event: put "hello"
'''

import mt_api
from mt_common import clean_params
from ansible.module_utils import mt_api
from ansible.module_utils.mt_common import clean_params
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
from: [email protected]
'''

from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule


Expand Down
2 changes: 1 addition & 1 deletion library/mt_user.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
group: read
'''

from mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.mt_common import clean_params, MikrotikIdempotent
from ansible.module_utils.basic import AnsibleModule


Expand Down
6 changes: 3 additions & 3 deletions pythonlibs/mt_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import ssl
import sys

from .retryloop import RetryError
from .retryloop import retryloop
from .socket_utils import set_keepalive
from ansible.module_utils.mt_api.retryloop import RetryError
from ansible.module_utils.mt_api.retryloop import retryloop
from ansible.module_utils.mt_api.socket_utils import set_keepalive

PY2 = sys.version_info[0] < 3
logger = logging.getLogger(__name__)
Expand Down
2 changes: 1 addition & 1 deletion pythonlibs/mt_common.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python
import mt_api
from ansible.module_utils import mt_api
import re
import sys

Expand Down
2 changes: 2 additions & 0 deletions tests/integration/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[defaults]
module_utils = ./pythonlibs/