1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

foreman: PEP8 compliancy and doc fixes (#30910)

This PR includes:
- PEP8 compliancy fixes
- Documentation fixes
This commit is contained in:
Dag Wieers 2017-10-03 09:50:27 +02:00 committed by GitHub
parent db70eeb913
commit 4a358b5396
3 changed files with 94 additions and 94 deletions

View file

@ -1,62 +1,62 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2016, Eric D Helms <ericdhelms@gmail.com>
# Copyright: (c) 2016, Eric D Helms <ericdhelms@gmail.com>
# 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)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1', ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: foreman module: foreman
short_description: Manage Foreman Resources short_description: Manage Foreman Resources
description: description:
- Allows the management of Foreman resources inside your Foreman server - Allows the management of Foreman resources inside your Foreman server.
version_added: "2.3" version_added: "2.3"
author: "Eric D Helms (@ehelms)" author:
- Eric D Helms (@ehelms)
requirements: requirements:
- "nailgun >= 0.28.0" - nailgun >= 0.28.0
- "python >= 2.6" - python >= 2.6
- datetime - datetime
options: options:
server_url: server_url:
description: description:
- URL of Foreman server - URL of Foreman server.
required: true required: true
username: username:
description: description:
- Username on Foreman server - Username on Foreman server.
required: true required: true
password: password:
description: description:
- Password for user accessing Foreman server - Password for user accessing Foreman server.
required: true required: true
entity: entity:
description: description:
- The Foreman resource that the action will be performed on (e.g. organization, host) - The Foreman resource that the action will be performed on (e.g. organization, host).
required: true required: true
params: params:
description: description:
- Parameters associated to the entity resource to set or edit in dictionary format (e.g. name, description) - Parameters associated to the entity resource to set or edit in dictionary format (e.g. name, description).
required: true required: true
''' '''
EXAMPLES = ''' EXAMPLES = '''
- name: "Create CI Organization" - name: Create CI Organization
local_action: foreman:
module: foreman username: admin
username: "admin" password: admin
password: "admin" server_url: https://fakeserver.com
server_url: "https://fakeserver.com" entity: organization
entity: "organization"
params: params:
name: "My Cool New Organization" name: My Cool New Organization
delegate_to: localhost
''' '''
RETURN = '''# ''' RETURN = '''# '''
@ -86,7 +86,7 @@ class NailGun(object):
if len(response) == 1: if len(response) == 1:
return response[0] return response[0]
else:
return None return None
def organization(self, params): def organization(self, params):
@ -103,17 +103,18 @@ class NailGun(object):
return True return True
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
server_url=dict(required=True), server_url=dict(type='str', required=True),
username=dict(required=True, no_log=True), username=dict(type='str', required=True, no_log=True),
password=dict(required=True, no_log=True), password=dict(type='str', required=True, no_log=True),
entity=dict(required=True, no_log=False), entity=dict(type='str', required=True),
verify_ssl=dict(required=False, type='bool', default=False), verify_ssl=dict(type='bool', default=False),
params=dict(required=True, no_log=True, type='dict'), params=dict(type='dict', required=True, no_log=True),
), ),
supports_check_mode=True supports_check_mode=True,
) )
if not HAS_NAILGUN_PACKAGE: if not HAS_NAILGUN_PACKAGE:

View file

@ -1,49 +1,49 @@
#!/usr/bin/python #!/usr/bin/python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# (c) 2016, Eric D Helms <ericdhelms@gmail.com>
# Copyright: (c) 2016, Eric D Helms <ericdhelms@gmail.com>
# 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)
from __future__ import absolute_import, division, print_function from __future__ import absolute_import, division, print_function
__metaclass__ = type __metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1', ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'], 'status': ['preview'],
'supported_by': 'community'} 'supported_by': 'community'}
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: katello module: katello
short_description: Manage Katello Resources short_description: Manage Katello Resources
description: description:
- Allows the management of Katello resources inside your Foreman server - Allows the management of Katello resources inside your Foreman server.
version_added: "2.3" version_added: "2.3"
author: "Eric D Helms (@ehelms)" author:
- Eric D Helms (@ehelms)
requirements: requirements:
- "nailgun >= 0.28.0" - nailgun >= 0.28.0
- "python >= 2.6" - python >= 2.6
- datetime - datetime
options: options:
server_url: server_url:
description: description:
- URL of Foreman server - URL of Foreman server.
required: true required: true
username: username:
description: description:
- Username on Foreman server - Username on Foreman server.
required: true required: true
password: password:
description: description:
- Password for user accessing Foreman server - Password for user accessing Foreman server.
required: true required: true
entity: entity:
description: description:
- The Foreman resource that the action will be performed on (e.g. organization, host) - The Foreman resource that the action will be performed on (e.g. organization, host).
required: true required: true
params: params:
description: description:
- Parameters associated to the entity resource to set or edit in dictionary format (e.g. name, description) - Parameters associated to the entity resource to set or edit in dictionary format (e.g. name, description).
required: true required: true
''' '''
@ -51,79 +51,79 @@ EXAMPLES = '''
--- ---
# Simple Example: # Simple Example:
- name: "Create Product" - name: Create Product
local_action: katello:
module: katello username: admin
username: "admin" password: admin
password: "admin" server_url: https://fakeserver.com
server_url: "https://fakeserver.com" entity: product
entity: "product"
params: params:
name: "Centos 7" name: Centos 7
delegate_to: localhost
# Abstraction Example: # Abstraction Example:
# katello.yml # katello.yml
--- ---
- name: "{{ name }}" - name: "{{ name }}"
local_action: katello:
module: katello username: admin
username: "admin" password: admin
password: "admin" server_url: https://fakeserver.com
server_url: "https://fakeserver.com"
entity: "{{ entity }}" entity: "{{ entity }}"
params: "{{ params }}" params: "{{ params }}"
delegate_to: localhost
# tasks.yml # tasks.yml
--- ---
- include: katello.yml - include: katello.yml
vars: vars:
name: "Create Dev Environment" name: Create Dev Environment
entity: "lifecycle_environment" entity: lifecycle_environment
params: params:
name: "Dev" name: Dev
prior: "Library" prior: Library
organization: "Default Organization" organization: Default Organization
- include: katello.yml - include: katello.yml
vars: vars:
name: "Create Centos Product" name: Create Centos Product
entity: "product" entity: product
params: params:
name: "Centos 7" name: Centos 7
organization: "Default Organization" organization: Default Organization
- include: katello.yml - include: katello.yml
vars: vars:
name: "Create 7.2 Repository" name: Create 7.2 Repository
entity: "repository" entity: repository
params: params:
name: "Centos 7.2" name: Centos 7.2
product: "Centos 7" product: Centos 7
organization: "Default Organization" organization: Default Organization
content_type: "yum" content_type: yum
url: "http://mirror.centos.org/centos/7/os/x86_64/" url: http://mirror.centos.org/centos/7/os/x86_64/
- include: katello.yml - include: katello.yml
vars: vars:
name: "Create Centos 7 View" name: Create Centos 7 View
entity: "content_view" entity: content_view
params: params:
name: "Centos 7 View" name: Centos 7 View
organization: "Default Organization" organization: Default Organization
repositories: repositories:
- name: "Centos 7.2" - name: Centos 7.2
product: "Centos 7" product: Centos 7
- include: katello.yml - include: katello.yml
vars: vars:
name: "Enable RHEL Product" name: Enable RHEL Product
entity: "repository_set" entity: repository_set
params: params:
name: "Red Hat Enterprise Linux 7 Server (RPMs)" name: Red Hat Enterprise Linux 7 Server (RPMs)
product: "Red Hat Enterprise Linux Server" product: Red Hat Enterprise Linux Server
organization: "Default Organization" organization: Default Organization
basearch: "x86_64" basearch: x86_64
releasever: "7" releasever: 7
''' '''
RETURN = '''# ''' RETURN = '''# '''
@ -441,18 +441,19 @@ class NailGun(object):
return True return True
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec=dict( argument_spec=dict(
server_url=dict(required=True), server_url=dict(type='str', required=True),
username=dict(required=True, no_log=True), username=dict(type='str', required=True, no_log=True),
password=dict(required=True, no_log=True), password=dict(type='str', required=True, no_log=True),
entity=dict(required=True, no_log=False), entity=dict(type='str', required=True),
action=dict(required=False, no_log=False), action=dict(type='str'),
verify_ssl=dict(required=False, type='bool', default=False), verify_ssl=dict(type='bool', default=False),
params=dict(required=True, no_log=True, type='dict'), params=dict(type='dict', required=True, no_log=True),
), ),
supports_check_mode=True supports_check_mode=True,
) )
if not HAS_NAILGUN_PACKAGE: if not HAS_NAILGUN_PACKAGE:

View file

@ -370,8 +370,6 @@ lib/ansible/modules/packaging/os/urpmi.py
lib/ansible/modules/packaging/os/yum.py lib/ansible/modules/packaging/os/yum.py
lib/ansible/modules/packaging/os/zypper.py lib/ansible/modules/packaging/os/zypper.py
lib/ansible/modules/packaging/os/zypper_repository.py lib/ansible/modules/packaging/os/zypper_repository.py
lib/ansible/modules/remote_management/foreman/foreman.py
lib/ansible/modules/remote_management/foreman/katello.py
lib/ansible/modules/remote_management/stacki/stacki_host.py lib/ansible/modules/remote_management/stacki/stacki_host.py
lib/ansible/modules/source_control/bzr.py lib/ansible/modules/source_control/bzr.py
lib/ansible/modules/source_control/hg.py lib/ansible/modules/source_control/hg.py