foreman: PEP8 compliancy and doc fixes (#30910)

This PR includes:
- PEP8 compliancy fixes
- Documentation fixes
pull/31247/head
Dag Wieers 7 years ago committed by GitHub
parent db70eeb913
commit 4a358b5396

@ -1,62 +1,62 @@
#!/usr/bin/python
# -*- 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)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = '''
---
module: foreman
short_description: Manage Foreman Resources
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"
author: "Eric D Helms (@ehelms)"
author:
- Eric D Helms (@ehelms)
requirements:
- "nailgun >= 0.28.0"
- "python >= 2.6"
- nailgun >= 0.28.0
- python >= 2.6
- datetime
options:
server_url:
description:
- URL of Foreman server
- URL of Foreman server.
required: true
username:
description:
- Username on Foreman server
- Username on Foreman server.
required: true
password:
description:
- Password for user accessing Foreman server
- Password for user accessing Foreman server.
required: true
entity:
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
params:
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
'''
EXAMPLES = '''
- name: "Create CI Organization"
local_action:
module: foreman
username: "admin"
password: "admin"
server_url: "https://fakeserver.com"
entity: "organization"
- name: Create CI Organization
foreman:
username: admin
password: admin
server_url: https://fakeserver.com
entity: organization
params:
name: "My Cool New Organization"
name: My Cool New Organization
delegate_to: localhost
'''
RETURN = '''# '''
@ -86,7 +86,7 @@ class NailGun(object):
if len(response) == 1:
return response[0]
else:
return None
def organization(self, params):
@ -103,17 +103,18 @@ class NailGun(object):
return True
def main():
module = AnsibleModule(
argument_spec=dict(
server_url=dict(required=True),
username=dict(required=True, no_log=True),
password=dict(required=True, no_log=True),
entity=dict(required=True, no_log=False),
verify_ssl=dict(required=False, type='bool', default=False),
params=dict(required=True, no_log=True, type='dict'),
server_url=dict(type='str', required=True),
username=dict(type='str', required=True, no_log=True),
password=dict(type='str', required=True, no_log=True),
entity=dict(type='str', required=True),
verify_ssl=dict(type='bool', default=False),
params=dict(type='dict', required=True, no_log=True),
),
supports_check_mode=True
supports_check_mode=True,
)
if not HAS_NAILGUN_PACKAGE:

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

@ -370,8 +370,6 @@ lib/ansible/modules/packaging/os/urpmi.py
lib/ansible/modules/packaging/os/yum.py
lib/ansible/modules/packaging/os/zypper.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/source_control/bzr.py
lib/ansible/modules/source_control/hg.py

Loading…
Cancel
Save