Validate DOCUMENTATION.author (#48993)
* Validate DOCUMENTATION.author Ensure that author line includes a GitHub account
This commit is contained in:
parent
9b44109ba3
commit
75407d3e43
15 changed files with 43 additions and 16 deletions
|
@ -17,7 +17,7 @@ module: os_keystone_domain
|
|||
short_description: Manage OpenStack Identity Domains
|
||||
author:
|
||||
- Monty Taylor (@emonty)
|
||||
- Haneef Ali
|
||||
- Haneef Ali (@haneefs)
|
||||
extends_documentation_fragment: openstack
|
||||
version_added: "2.1"
|
||||
description:
|
||||
|
|
|
@ -13,7 +13,10 @@ DOCUMENTATION = '''
|
|||
---
|
||||
module: cyberark_authentication
|
||||
short_description: Module for CyberArk Vault Authentication using PAS Web Services SDK
|
||||
author: Edward Nunez @ CyberArk BizDev (@enunez-cyberark, @cyberark-bizdev, @erasmix)
|
||||
author:
|
||||
- Edward Nunez (@enunez-cyberark) CyberArk BizDev
|
||||
- Cyberark Bizdev (@cyberark-bizdev)
|
||||
- erasmix (@erasmix)
|
||||
version_added: 2.4
|
||||
description:
|
||||
- Authenticates to CyberArk Vault using Privileged Account Security Web Services SDK and
|
||||
|
|
|
@ -13,7 +13,10 @@ DOCUMENTATION = '''
|
|||
---
|
||||
module: cyberark_user
|
||||
short_description: Module for CyberArk User Management using PAS Web Services SDK
|
||||
author: Edward Nunez @ CyberArk BizDev (@enunez-cyberark, @cyberark-bizdev, @erasmix)
|
||||
author:
|
||||
- Edward Nunez (@enunez-cyberark) CyberArk BizDev
|
||||
- Cyberark Bizdev (@cyberark-bizdev)
|
||||
- erasmix (@erasmix)
|
||||
version_added: 2.4
|
||||
description:
|
||||
- CyberArk User Management using PAS Web Services SDK. It currently supports the following
|
||||
|
|
|
@ -23,7 +23,7 @@ version_added: "1.2"
|
|||
author:
|
||||
- "Andrew Newdigate (@suprememoocow)"
|
||||
- "Dylan Silva (@thaumos)"
|
||||
- "Justin Johns"
|
||||
- "Justin Johns (!UNKNOWN)"
|
||||
- "Bruce Pennypacker (@bpennypacker)"
|
||||
requirements:
|
||||
- PagerDuty API access
|
||||
|
|
|
@ -21,7 +21,7 @@ description:
|
|||
version_added: "1.2"
|
||||
author:
|
||||
- "Dylan Silva (@thaumos)"
|
||||
- "Justin Johns"
|
||||
- "Justin Johns (!UNKNOWN)"
|
||||
requirements:
|
||||
- "This pingdom python library: https://github.com/mbabineau/pingdom-python"
|
||||
options:
|
||||
|
|
|
@ -23,7 +23,7 @@ description:
|
|||
version_added: "1.8"
|
||||
author:
|
||||
- "Cove (@cove)"
|
||||
- "Tony Minfei Ding"
|
||||
- "Tony Minfei Ding (!UNKNOWN)"
|
||||
- "Harrison Gu (@harrisongu)"
|
||||
requirements:
|
||||
- "python >= 2.6"
|
||||
|
|
|
@ -22,7 +22,7 @@ description:
|
|||
version_added: "2.0"
|
||||
author:
|
||||
- "Cove (@cove)"
|
||||
- Tony Minfei Ding
|
||||
- Tony Minfei Ding (!UNKNOWN)
|
||||
- Harrison Gu (@harrisongu)
|
||||
- Werner Dijkerman (@dj-wasabi)
|
||||
- Eike Frost (@eikef)
|
||||
|
|
|
@ -22,7 +22,7 @@ description:
|
|||
version_added: "2.0"
|
||||
author:
|
||||
- "Cove (@cove)"
|
||||
- Dean Hailin Song
|
||||
- Dean Hailin Song (!UNKNOWN)
|
||||
requirements:
|
||||
- "python >= 2.6"
|
||||
- zabbix-api
|
||||
|
|
|
@ -22,7 +22,7 @@ description:
|
|||
version_added: "2.0"
|
||||
author:
|
||||
- "Cove (@cove)"
|
||||
- "Tony Minfei Ding"
|
||||
- "Tony Minfei Ding (!UNKNOWN)"
|
||||
- "Harrison Gu (@harrisongu)"
|
||||
requirements:
|
||||
- "python >= 2.6"
|
||||
|
|
|
@ -27,7 +27,7 @@ version_added: "2.4"
|
|||
short_description: Manages configuration of an OSPF VPN instance on HUAWEI CloudEngine switches.
|
||||
description:
|
||||
- Manages configuration of an OSPF VPN instance on HUAWEI CloudEngine switches.
|
||||
author: Yang yang (@CloudEngine Ansible)
|
||||
author: Yang yang (@QijunPan)
|
||||
options:
|
||||
ospf:
|
||||
description:
|
||||
|
|
|
@ -25,7 +25,7 @@ module: panos_sag
|
|||
short_description: Create a static address group.
|
||||
description:
|
||||
- Create a static address group object in the firewall used for policy rules.
|
||||
author: "Vinay Venkataraghavan @vinayvenkat"
|
||||
author: "Vinay Venkataraghavan (@vinayvenkat)"
|
||||
version_added: "2.4"
|
||||
requirements:
|
||||
- pan-python can be obtained from PyPI U(https://pypi.org/project/pan-python/)
|
||||
|
|
|
@ -23,7 +23,7 @@ description:
|
|||
version_added: "2.6"
|
||||
author:
|
||||
- "David Gunter (@verkaufer)"
|
||||
- "Chris Hoffman (@chrishoffman, creator of NPM Ansible module)"
|
||||
- "Chris Hoffman (@chrishoffman), creator of NPM Ansible module)"
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
|
|
|
@ -128,7 +128,7 @@ requirements:
|
|||
- cron
|
||||
author:
|
||||
- Dane Summers (@dsummersl)
|
||||
- Mike Grozak
|
||||
- Mike Grozak (@rhaido)
|
||||
- Patrick Callahan (@dirtyharrycallahan)
|
||||
- Evan Kaufman (@EvanK)
|
||||
- Luca Berruti (@lberruti)
|
||||
|
|
|
@ -83,7 +83,7 @@ notes:
|
|||
author:
|
||||
- "Ansible Core Team"
|
||||
- "Michael DeHaan"
|
||||
- "David O'Brien @david_obrien davidobrien1985"
|
||||
- "David O'Brien (@davidobrien1985)"
|
||||
'''
|
||||
|
||||
EXAMPLES = """
|
||||
|
|
|
@ -16,11 +16,21 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from voluptuous import ALLOW_EXTRA, PREVENT_EXTRA, All, Any, Length, Required, Schema, Self
|
||||
import re
|
||||
from voluptuous import ALLOW_EXTRA, PREVENT_EXTRA, All, Any, Length, Invalid, Required, Schema, Self
|
||||
from ansible.module_utils.six import string_types
|
||||
from ansible.module_utils.common.collections import is_iterable
|
||||
list_string_types = list(string_types)
|
||||
any_string_types = Any(*string_types)
|
||||
|
||||
# Valid DOCUMENTATION.author lines
|
||||
# Based on Ansibulbot's extract_github_id()
|
||||
# author: First Last (@name) [optional anything]
|
||||
# "Ansible Core Team" - Used by the Bot
|
||||
# "Michael DeHaan" - nop
|
||||
# "Name (!UNKNOWN)" - For the few untraceable authors
|
||||
author_line = re.compile(r'^\w.*(\(@([\w-]+)\)|!UNKNOWN)(?![\w.])|^Ansible Core Team$|^Michael DeHaan$')
|
||||
|
||||
|
||||
def sequence_of_sequences(min=None, max=None):
|
||||
return All(
|
||||
|
@ -140,6 +150,17 @@ deprecation_schema = Schema(
|
|||
)
|
||||
|
||||
|
||||
def author(value):
|
||||
|
||||
if not is_iterable(value):
|
||||
value = [value]
|
||||
|
||||
for line in value:
|
||||
m = author_line.search(line)
|
||||
if not m:
|
||||
raise Invalid("Invalid author")
|
||||
|
||||
|
||||
def doc_schema(module_name):
|
||||
deprecated_module = False
|
||||
|
||||
|
@ -151,7 +172,7 @@ def doc_schema(module_name):
|
|||
Required('short_description'): Any(*string_types),
|
||||
Required('description'): Any(list_string_types, *string_types),
|
||||
Required('version_added'): Any(float, *string_types),
|
||||
Required('author'): Any(None, list_string_types, *string_types),
|
||||
Required('author'): All(Any(None, list_string_types, *string_types), author),
|
||||
'notes': Any(None, list_string_types),
|
||||
'requirements': list_string_types,
|
||||
'todo': Any(None, list_string_types, *string_types),
|
||||
|
|
Loading…
Reference in a new issue