rpm_key: PEP8 compliancy and documentation changes (#33426)

This PR includes:
- PEP8 compliancy changes
- Documentation changes
This commit is contained in:
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 -*-
# 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)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'core'}
DOCUMENTATION = '''
---
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
description:
- Adds or removes (rpm --import) a gpg key to your rpm database.
version_added: "1.3"
options:
key:
required: true
default: null
aliases: []
description:
- 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:
required: false
default: "present"
choices: [present, absent]
description:
- If the key will be imported or removed from the rpm db.
default: present
choices: [ absent, present ]
validate_certs:
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
on personally controlled sites using self-signed certificates.
required: false
type: bool
default: 'yes'
choices: ['yes', 'no']
'''
EXAMPLES = '''
@ -92,7 +86,7 @@ class RpmKey(object):
self.gpg = self.module.get_bin_path('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:
keyfile = self.fetch_key(key)
@ -192,13 +186,13 @@ class RpmKey(object):
def main():
module = AnsibleModule(
argument_spec = dict(
state=dict(default='present', choices=['present', 'absent'], type='str'),
key=dict(required=True, type='str'),
validate_certs=dict(default='yes', type='bool'),
),
supports_check_mode=True
)
argument_spec=dict(
state=dict(type='str', default='present', choices=['absent', 'present']),
key=dict(type='str', required=True),
validate_certs=dict(type='bool', default=True),
),
supports_check_mode=True,
)
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/portage.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/svr4pkg.py
lib/ansible/modules/packaging/os/swdepot.py