rpm_key: PEP8 compliancy and documentation changes (#33426)

This PR includes:
- PEP8 compliancy changes
- Documentation changes
pull/4420/head
Dag Wieers 2017-12-04 13:30:27 +01:00 committed by GitHub
parent fbfeeff6bf
commit ff50b7893c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 23 deletions

View File

@ -2,48 +2,42 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
# Ansible module to import third party repo keys to your rpm db # Ansible module to import third party repo keys to your rpm db
# (c) 2013, Héctor Acosta <hector.acosta@gazzang.com> # Copyright: (c) 2013, Héctor Acosta <hector.acosta@gazzang.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': 'core'} 'supported_by': 'core'}
DOCUMENTATION = ''' DOCUMENTATION = '''
--- ---
module: rpm_key module: rpm_key
author: "Hector Acosta (@hacosta) <hector.acosta@gazzang.com>" author:
- Hector Acosta (@hacosta) <hector.acosta@gazzang.com>
short_description: Adds or removes a gpg key from the rpm db short_description: Adds or removes a gpg key from the rpm db
description: description:
- Adds or removes (rpm --import) a gpg key to your rpm database. - Adds or removes (rpm --import) a gpg key to your rpm database.
version_added: "1.3" version_added: "1.3"
options: options:
key: key:
required: true
default: null
aliases: []
description: description:
- Key that will be modified. Can be a url, a file, or a keyid if the key already exists in the database. - Key that will be modified. Can be a url, a file, or a keyid if the key already exists in the database.
required: true
state: state:
required: false
default: "present"
choices: [present, absent]
description: description:
- If the key will be imported or removed from the rpm db. - If the key will be imported or removed from the rpm db.
default: present
choices: [ absent, present ]
validate_certs: validate_certs:
description: description:
- If C(no) and the C(key) is a url starting with https, SSL certificates will not be validated. This should only be used - If C(no) and the C(key) is a url starting with https, SSL certificates will not be validated. This should only be used
on personally controlled sites using self-signed certificates. on personally controlled sites using self-signed certificates.
required: false type: bool
default: 'yes' default: 'yes'
choices: ['yes', 'no']
''' '''
EXAMPLES = ''' EXAMPLES = '''
@ -92,7 +86,7 @@ class RpmKey(object):
self.gpg = self.module.get_bin_path('gpg') self.gpg = self.module.get_bin_path('gpg')
if not self.gpg: if not self.gpg:
self.gpg = self.module.get_bin_path('gpg2',required=True) self.gpg = self.module.get_bin_path('gpg2', required=True)
if '://' in key: if '://' in key:
keyfile = self.fetch_key(key) keyfile = self.fetch_key(key)
@ -192,12 +186,12 @@ class RpmKey(object):
def main(): def main():
module = AnsibleModule( module = AnsibleModule(
argument_spec = dict( argument_spec=dict(
state=dict(default='present', choices=['present', 'absent'], type='str'), state=dict(type='str', default='present', choices=['absent', 'present']),
key=dict(required=True, type='str'), key=dict(type='str', required=True),
validate_certs=dict(default='yes', type='bool'), validate_certs=dict(type='bool', default=True),
), ),
supports_check_mode=True supports_check_mode=True,
) )
RpmKey(module) RpmKey(module)

View File

@ -270,7 +270,6 @@ lib/ansible/modules/packaging/os/pkgng.py
lib/ansible/modules/packaging/os/pkgutil.py lib/ansible/modules/packaging/os/pkgutil.py
lib/ansible/modules/packaging/os/portage.py lib/ansible/modules/packaging/os/portage.py
lib/ansible/modules/packaging/os/portinstall.py lib/ansible/modules/packaging/os/portinstall.py
lib/ansible/modules/packaging/os/rpm_key.py
lib/ansible/modules/packaging/os/sorcery.py lib/ansible/modules/packaging/os/sorcery.py
lib/ansible/modules/packaging/os/svr4pkg.py lib/ansible/modules/packaging/os/svr4pkg.py
lib/ansible/modules/packaging/os/swdepot.py lib/ansible/modules/packaging/os/swdepot.py