mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Fix shebangs and file modes and update tests. (#40563)
* Add execute bit sanity test and apply fixes. * Add shebang test for `lib` dirs and apply fixes. * Shebang and execute bit cleanup.
This commit is contained in:
parent
f84f3de7c2
commit
8deced3e04
39 changed files with 17 additions and 11 deletions
0
contrib/inventory/lxd.py
Normal file → Executable file
0
contrib/inventory/lxd.py
Normal file → Executable file
0
hacking/fix_test_syntax.py
Normal file → Executable file
0
hacking/fix_test_syntax.py
Normal file → Executable file
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) 2017 Ansible Project
|
# Copyright (c) 2017 Ansible Project
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
# Copyright (c) 2017 Ansible Project
|
# Copyright (c) 2017 Ansible Project
|
||||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||||
|
|
||||||
|
|
0
lib/ansible/module_utils/gitlab.py
Executable file → Normal file
0
lib/ansible/module_utils/gitlab.py
Executable file → Normal file
0
lib/ansible/module_utils/manageiq.py
Executable file → Normal file
0
lib/ansible/module_utils/manageiq.py
Executable file → Normal file
0
lib/ansible/modules/cloud/amazon/ec2_lc.py
Executable file → Normal file
0
lib/ansible/modules/cloud/amazon/ec2_lc.py
Executable file → Normal file
0
lib/ansible/modules/cloud/azure/azure_rm_loadbalancer.py
Executable file → Normal file
0
lib/ansible/modules/cloud/azure/azure_rm_loadbalancer.py
Executable file → Normal file
0
lib/ansible/modules/cloud/docker/docker_service.py
Executable file → Normal file
0
lib/ansible/modules/cloud/docker/docker_service.py
Executable file → Normal file
0
lib/ansible/modules/cloud/vmware/vmware_datastore_facts.py
Executable file → Normal file
0
lib/ansible/modules/cloud/vmware/vmware_datastore_facts.py
Executable file → Normal file
0
lib/ansible/modules/clustering/k8s/_kubernetes.py
Executable file → Normal file
0
lib/ansible/modules/clustering/k8s/_kubernetes.py
Executable file → Normal file
0
lib/ansible/modules/clustering/znode.py
Executable file → Normal file
0
lib/ansible/modules/clustering/znode.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_aep_to_domain.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_aep_to_domain.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_contract_subject.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_contract_subject.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_domain_to_vlan_pool.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_domain_to_vlan_pool.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_tenant_ep_retention_policy.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_tenant_ep_retention_policy.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_tenant_span_src_group.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_tenant_span_src_group.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_tenant_span_src_group_to_dst_group.py
Executable file → Normal file
0
lib/ansible/modules/network/aci/aci_tenant_span_src_group_to_dst_group.py
Executable file → Normal file
0
lib/ansible/modules/network/bigswitch/bcf_switch.py
Executable file → Normal file
0
lib/ansible/modules/network/bigswitch/bcf_switch.py
Executable file → Normal file
0
lib/ansible/modules/network/bigswitch/bigmon_chain.py
Executable file → Normal file
0
lib/ansible/modules/network/bigswitch/bigmon_chain.py
Executable file → Normal file
0
lib/ansible/modules/network/panos/panos_sag.py
Executable file → Normal file
0
lib/ansible/modules/network/panos/panos_sag.py
Executable file → Normal file
0
lib/ansible/modules/network/panos/panos_security_rule.py
Executable file → Normal file
0
lib/ansible/modules/network/panos/panos_security_rule.py
Executable file → Normal file
0
lib/ansible/modules/notification/logentries_msg.py
Executable file → Normal file
0
lib/ansible/modules/notification/logentries_msg.py
Executable file → Normal file
0
lib/ansible/modules/notification/snow_record.py
Executable file → Normal file
0
lib/ansible/modules/notification/snow_record.py
Executable file → Normal file
0
lib/ansible/modules/remote_management/hpilo/hpilo_boot.py
Executable file → Normal file
0
lib/ansible/modules/remote_management/hpilo/hpilo_boot.py
Executable file → Normal file
0
lib/ansible/modules/remote_management/hpilo/hpilo_facts.py
Executable file → Normal file
0
lib/ansible/modules/remote_management/hpilo/hpilo_facts.py
Executable file → Normal file
0
lib/ansible/modules/remote_management/manageiq/manageiq_user.py
Executable file → Normal file
0
lib/ansible/modules/remote_management/manageiq/manageiq_user.py
Executable file → Normal file
0
lib/ansible/modules/source_control/gitlab_deploy_key.py
Executable file → Normal file
0
lib/ansible/modules/source_control/gitlab_deploy_key.py
Executable file → Normal file
0
lib/ansible/modules/source_control/gitlab_hooks.py
Executable file → Normal file
0
lib/ansible/modules/source_control/gitlab_hooks.py
Executable file → Normal file
0
lib/ansible/modules/system/interfaces_file.py
Executable file → Normal file
0
lib/ansible/modules/system/interfaces_file.py
Executable file → Normal file
0
lib/ansible/modules/system/service_facts.py
Executable file → Normal file
0
lib/ansible/modules/system/service_facts.py
Executable file → Normal file
0
lib/ansible/modules/web_infrastructure/jenkins_job_facts.py
Executable file → Normal file
0
lib/ansible/modules/web_infrastructure/jenkins_job_facts.py
Executable file → Normal file
0
lib/ansible/plugins/inventory/foreman.py
Executable file → Normal file
0
lib/ansible/plugins/inventory/foreman.py
Executable file → Normal file
|
@ -1,4 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
"""Foreman plugin for integration tests."""
|
"""Foreman plugin for integration tests."""
|
||||||
|
|
||||||
from __future__ import absolute_import, print_function
|
from __future__ import absolute_import, print_function
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import stat
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +25,6 @@ def main():
|
||||||
}
|
}
|
||||||
|
|
||||||
skip = set([
|
skip = set([
|
||||||
'hacking/cherrypick.py',
|
|
||||||
'test/integration/targets/win_module_utils/library/legacy_only_new_way_win_line_ending.ps1',
|
'test/integration/targets/win_module_utils/library/legacy_only_new_way_win_line_ending.ps1',
|
||||||
'test/integration/targets/win_module_utils/library/legacy_only_old_way_win_line_ending.ps1',
|
'test/integration/targets/win_module_utils/library/legacy_only_old_way_win_line_ending.ps1',
|
||||||
])
|
])
|
||||||
|
@ -35,17 +35,27 @@ def main():
|
||||||
|
|
||||||
with open(path, 'rb') as path_fd:
|
with open(path, 'rb') as path_fd:
|
||||||
shebang = path_fd.readline().strip()
|
shebang = path_fd.readline().strip()
|
||||||
|
mode = os.stat(path).st_mode
|
||||||
|
executable = (stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH) & mode
|
||||||
|
|
||||||
if not shebang:
|
if not shebang or not shebang.startswith(b'#!'):
|
||||||
continue
|
if executable:
|
||||||
|
print('%s:%d:%d: file without shebang should not be executable' % (path, 0, 0))
|
||||||
|
|
||||||
if not shebang.startswith(b'#!'):
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
is_module = False
|
is_module = False
|
||||||
|
|
||||||
if path.startswith('lib/ansible/modules/'):
|
if path.startswith('lib/ansible/modules/'):
|
||||||
is_module = True
|
is_module = True
|
||||||
|
elif path.startswith('lib/') or path.startswith('test/runner/lib/'):
|
||||||
|
if executable:
|
||||||
|
print('%s:%d:%d: should not be executable' % (path, 0, 0))
|
||||||
|
|
||||||
|
if shebang:
|
||||||
|
print('%s:%d:%d: should not have a shebang' % (path, 0, 0))
|
||||||
|
|
||||||
|
continue
|
||||||
elif path.startswith('test/integration/targets/'):
|
elif path.startswith('test/integration/targets/'):
|
||||||
dirname = os.path.dirname(path)
|
dirname = os.path.dirname(path)
|
||||||
|
|
||||||
|
@ -57,6 +67,9 @@ def main():
|
||||||
is_module = True
|
is_module = True
|
||||||
|
|
||||||
if is_module:
|
if is_module:
|
||||||
|
if executable:
|
||||||
|
print('%s:%d:%d: module should not be executable' % (path, 0, 0))
|
||||||
|
|
||||||
ext = os.path.splitext(path)[1]
|
ext = os.path.splitext(path)[1]
|
||||||
expected_shebang = module_shebangs.get(ext)
|
expected_shebang = module_shebangs.get(ext)
|
||||||
expected_ext = ' or '.join(['"%s"' % k for k in module_shebangs])
|
expected_ext = ' or '.join(['"%s"' % k for k in module_shebangs])
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# This is a standalone test for the regex inside validate-modules
|
# This is a standalone test for the regex inside validate-modules
|
||||||
# It is not suitable to add to the make tests target because the
|
# It is not suitable to add to the make tests target because the
|
||||||
# file under test is outside the test's sys.path AND has a hyphen
|
# file under test is outside the test's sys.path AND has a hyphen
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
#
|
|
||||||
# (c) 2016 Red Hat Inc.
|
# (c) 2016 Red Hat Inc.
|
||||||
#
|
#
|
||||||
# This file is part of Ansible
|
# This file is part of Ansible
|
||||||
|
|
0
test/units/modules/source_control/test_gitlab_deploy_key.py
Executable file → Normal file
0
test/units/modules/source_control/test_gitlab_deploy_key.py
Executable file → Normal file
0
test/units/modules/source_control/test_gitlab_hooks.py
Executable file → Normal file
0
test/units/modules/source_control/test_gitlab_hooks.py
Executable file → Normal file
Loading…
Reference in a new issue