Skip to content
This repository was archived by the owner on Jan 1, 2024. It is now read-only.

Commit 8e4a7be

Browse files
authored
Fix compatibility with Ansible 2.8 (#273)
Closes #274 Before this patch, imports in library functions didn't work. Now it's work in Ansible 2.8 too.
1 parent 6ecf7ad commit 8e4a7be

40 files changed

+267
-249
lines changed

.github/helpers/count_molecule_matrix.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def main(event_name, repo_owner, review_state, ref):
3737
if event_name == 'workflow_dispatch' or review_state == 'approved' or ref == 'refs/heads/master':
3838
ce_matrix.append(get_ce_params(molecule_scenario='update_cartridge'))
3939
ce_matrix.append(get_ce_params(tarantool_version='1.10'))
40+
ce_matrix.append(get_ce_params(ansible_version='2.8.0'))
4041
ce_matrix.append(get_ce_params(ansible_version='2.9.0'))
4142
# TODO: Uncomment after fixing the check mode
4243
# ce_matrix.append(get_ce_version(molecule_command='check'))

library/cartridge_bootstrap_vshard.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

3-
import pkgutil
4-
5-
if pkgutil.find_loader('ansible.module_utils.helpers'):
6-
import ansible.module_utils.helpers as helpers
7-
else:
8-
import module_utils.helpers as helpers
3+
from ansible.module_utils.helpers import Helpers as helpers
94

105
argument_spec = {
116
'console_sock': {'required': True, 'type': 'str'},

library/cartridge_check_instance_state.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

3-
import pkgutil
4-
5-
if pkgutil.find_loader('ansible.module_utils.helpers'):
6-
import ansible.module_utils.helpers as helpers
7-
else:
8-
import module_utils.helpers as helpers
3+
from ansible.module_utils.helpers import Helpers as helpers
94

105
argument_spec = {
116
'console_sock': {'required': True, 'type': 'str'},

library/cartridge_configure_app_config.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

3-
import pkgutil
4-
5-
if pkgutil.find_loader('ansible.module_utils.helpers'):
6-
import ansible.module_utils.helpers as helpers
7-
else:
8-
import module_utils.helpers as helpers
3+
from ansible.module_utils.helpers import Helpers as helpers
94

105
argument_spec = {
116
'app_config': {'required': True, 'type': 'dict'},

library/cartridge_configure_auth.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

3-
import pkgutil
4-
5-
if pkgutil.find_loader('ansible.module_utils.helpers'):
6-
import ansible.module_utils.helpers as helpers
7-
else:
8-
import module_utils.helpers as helpers
3+
from ansible.module_utils.helpers import Helpers as helpers
94

105
argument_spec = {
116
'auth': {'required': True, 'type': 'dict'},

library/cartridge_configure_failover.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

3-
import pkgutil
4-
5-
if pkgutil.find_loader('ansible.module_utils.helpers'):
6-
import ansible.module_utils.helpers as helpers
7-
else:
8-
import module_utils.helpers as helpers
3+
from ansible.module_utils.helpers import Helpers as helpers
94

105
argument_spec = {
116
'console_sock': {'required': True, 'type': 'str'},

library/cartridge_connect_to_membership.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

3-
import pkgutil
4-
5-
if pkgutil.find_loader('ansible.module_utils.helpers'):
6-
import ansible.module_utils.helpers as helpers
7-
else:
8-
import module_utils.helpers as helpers
3+
from ansible.module_utils.helpers import Helpers as helpers
94

105
argument_spec = {
116
'console_sock': {'required': True, 'type': 'str'},

library/cartridge_edit_topology.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

3-
import pkgutil
43
import time
54

6-
if pkgutil.find_loader('ansible.module_utils.helpers'):
7-
import ansible.module_utils.helpers as helpers
8-
else:
9-
import module_utils.helpers as helpers
5+
from ansible.module_utils.helpers import Helpers as helpers
106

117
argument_spec = {
128
'hostvars': {'required': True, 'type': 'dict'},
@@ -398,7 +394,8 @@ def get_topology_params(replicasets, cluster_replicasets, instances, cluster_ins
398394

399395

400396
def get_replicasets_failover_priority_and_instances_params(
401-
replicasets, cluster_replicasets, instances, cluster_instances):
397+
replicasets, cluster_replicasets, instances, cluster_instances
398+
):
402399
topology_params = {}
403400

404401
replicasets_params, err = get_replicasets_params_for_changing_failover_priority(
@@ -440,7 +437,8 @@ def wait_for_cluster_is_healthy(control_console, timeout):
440437

441438

442439
def update_cluster_instances_and_replicasets(
443-
edit_topology_res, instances, cluster_instances, cluster_replicasets):
440+
edit_topology_res, instances, cluster_instances, cluster_replicasets
441+
):
444442
# instances
445443
for alias, res_instance in edit_topology_res['servers'].items():
446444
cluster_instances[alias] = res_instance

library/cartridge_get_control_instance.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

3-
import pkgutil
4-
5-
if pkgutil.find_loader('ansible.module_utils.helpers'):
6-
import ansible.module_utils.helpers as helpers
7-
else:
8-
import module_utils.helpers as helpers
3+
from ansible.module_utils.helpers import Helpers as helpers
94

105
argument_spec = {
116
'hostvars': {'required': True, 'type': 'dict'},

library/cartridge_get_dist_dirs_to_remove.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
#!/usr/bin/python
1+
#!/usr/bin/env python
22

33
import os
4-
import pkgutil
54
import re
65

7-
if pkgutil.find_loader('ansible.module_utils.helpers'):
8-
import ansible.module_utils.helpers as helpers
9-
else:
10-
import module_utils.helpers as helpers
11-
6+
from ansible.module_utils.helpers import Helpers as helpers
127

138
argument_spec = {
149
'app_name': {'required': False, 'type': 'str'},

0 commit comments

Comments
 (0)