mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
PEP 8 W291 whitespace cleanup.
This commit is contained in:
parent
95789f3949
commit
d913f69ba1
166 changed files with 493 additions and 565 deletions
|
@ -155,12 +155,12 @@ def grant_check(module, gs, obj):
|
|||
grant = [ x for x in acp.entries.entry_list if x.scope.type == 'AllUsers']
|
||||
if not grant:
|
||||
obj.set_acl('public-read')
|
||||
module.exit_json(changed=True, result="The objects permission as been set to public-read")
|
||||
module.exit_json(changed=True, result="The objects permission as been set to public-read")
|
||||
if module.params.get('permission') == 'authenticated-read':
|
||||
grant = [ x for x in acp.entries.entry_list if x.scope.type == 'AllAuthenticatedUsers']
|
||||
if not grant:
|
||||
obj.set_acl('authenticated-read')
|
||||
module.exit_json(changed=True, result="The objects permission as been set to authenticated-read")
|
||||
module.exit_json(changed=True, result="The objects permission as been set to authenticated-read")
|
||||
except gs.provider.storage_response_error as e:
|
||||
module.fail_json(msg= str(e))
|
||||
return True
|
||||
|
@ -240,7 +240,7 @@ def create_dirkey(module, gs, bucket, obj):
|
|||
|
||||
def path_check(path):
|
||||
if os.path.exists(path):
|
||||
return True
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
@ -262,7 +262,7 @@ def transform_headers(headers):
|
|||
def upload_gsfile(module, gs, bucket, obj, src, expiry):
|
||||
try:
|
||||
bucket = gs.lookup(bucket)
|
||||
key = bucket.new_key(obj)
|
||||
key = bucket.new_key(obj)
|
||||
key.set_contents_from_filename(
|
||||
filename=src,
|
||||
headers=transform_headers(module.params.get('headers'))
|
||||
|
@ -326,7 +326,7 @@ def handle_put(module, gs, bucket, obj, overwrite, src, expiration):
|
|||
else:
|
||||
upload_gsfile(module, gs, bucket, obj, src, expiration)
|
||||
|
||||
if not bucket_rc:
|
||||
if not bucket_rc:
|
||||
create_bucket(module, gs, bucket)
|
||||
upload_gsfile(module, gs, bucket, obj, src, expiration)
|
||||
|
||||
|
@ -352,7 +352,7 @@ def handle_delete(module, gs, bucket, obj):
|
|||
module.fail_json(msg="Bucket or Bucket & object parameter is required.", failed=True)
|
||||
|
||||
def handle_create(module, gs, bucket, obj):
|
||||
if bucket and not obj:
|
||||
if bucket and not obj:
|
||||
if bucket_check(module, gs, bucket):
|
||||
module.exit_json(msg="Bucket already exists.", changed=False)
|
||||
else:
|
||||
|
@ -366,7 +366,7 @@ def handle_create(module, gs, bucket, obj):
|
|||
if bucket_check(module, gs, bucket):
|
||||
if key_check(module, gs, bucket, dirobj):
|
||||
module.exit_json(msg="Bucket %s and key %s already exists."% (bucket, obj), changed=False)
|
||||
else:
|
||||
else:
|
||||
create_dirkey(module, gs, bucket, dirobj)
|
||||
else:
|
||||
create_bucket(module, gs, bucket)
|
||||
|
@ -431,7 +431,7 @@ def main():
|
|||
module.fail_json(msg="Local object for PUT does not exist", failed=True)
|
||||
handle_put(module, gs, bucket, obj, overwrite, src, expiry)
|
||||
|
||||
# Support for deleting an object if we have both params.
|
||||
# Support for deleting an object if we have both params.
|
||||
if mode == 'delete':
|
||||
handle_delete(module, gs, bucket, obj)
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ notes:
|
|||
- See also M(gcdns_zone).
|
||||
- This modules's underlying library does not support in-place updates for
|
||||
DNS resource records. Instead, resource records are quickly deleted and
|
||||
recreated.
|
||||
recreated.
|
||||
- SOA records are technically supported, but their functionality is limited
|
||||
to verifying that a zone's existing SOA record matches a pre-determined
|
||||
value. The SOA record cannot be updated.
|
||||
|
|
|
@ -86,7 +86,7 @@ options:
|
|||
description:
|
||||
- the protocol used for the load-balancer packet forwarding, tcp or udp
|
||||
required: false
|
||||
default: "tcp"
|
||||
default: "tcp"
|
||||
choices: ['tcp', 'udp']
|
||||
region:
|
||||
description:
|
||||
|
@ -151,7 +151,7 @@ author: "Eric Johnson (@erjohnso) <erjohnso@google.com>"
|
|||
|
||||
EXAMPLES = '''
|
||||
# Simple example of creating a new LB, adding members, and a health check
|
||||
- local_action:
|
||||
- local_action:
|
||||
module: gce_lb
|
||||
name: testlb
|
||||
region: us-central1
|
||||
|
|
|
@ -293,7 +293,7 @@ except ImportError:
|
|||
|
||||
|
||||
def _check_params(params, field_list):
|
||||
"""
|
||||
"""
|
||||
Helper to validate params.
|
||||
|
||||
Use this in function definitions if they require specific fields
|
||||
|
@ -323,7 +323,7 @@ def _check_params(params, field_list):
|
|||
|
||||
|
||||
def _validate_autoscaling_params(params):
|
||||
"""
|
||||
"""
|
||||
Validate that the minimum configuration is present for autoscaling.
|
||||
|
||||
:param params: Ansible dictionary containing autoscaling configuration
|
||||
|
@ -331,7 +331,7 @@ def _validate_autoscaling_params(params):
|
|||
key 'autoscaling'.
|
||||
:type params: ``dict``
|
||||
|
||||
:return: Tuple containing a boolean and a string. True if autoscaler
|
||||
:return: Tuple containing a boolean and a string. True if autoscaler
|
||||
is valid, False otherwise, plus str for message.
|
||||
:rtype: ``(``bool``, ``str``)``
|
||||
"""
|
||||
|
@ -372,7 +372,7 @@ def _validate_autoscaling_params(params):
|
|||
|
||||
|
||||
def _validate_named_port_params(params):
|
||||
"""
|
||||
"""
|
||||
Validate the named ports parameters
|
||||
|
||||
:param params: Ansible dictionary containing named_ports configuration
|
||||
|
@ -404,7 +404,7 @@ def _validate_named_port_params(params):
|
|||
|
||||
|
||||
def _get_instance_list(mig, field='name', filter_list=['NONE']):
|
||||
"""
|
||||
"""
|
||||
Helper to grab field from instances response.
|
||||
|
||||
:param mig: Managed Instance Group Object from libcloud.
|
||||
|
@ -427,10 +427,10 @@ def _get_instance_list(mig, field='name', filter_list=['NONE']):
|
|||
|
||||
|
||||
def _gen_gce_as_policy(as_params):
|
||||
"""
|
||||
"""
|
||||
Take Autoscaler params and generate GCE-compatible policy.
|
||||
|
||||
:param as_params: Dictionary in Ansible-playbook format
|
||||
:param as_params: Dictionary in Ansible-playbook format
|
||||
containing policy arguments.
|
||||
:type as_params: ``dict``
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ options:
|
|||
description:
|
||||
- Dictionary containing a subscripton name associated with a topic (required), along with optional ack_deadline, push_endpoint and pull. For pulling from a subscription, message_ack (bool), max_messages (int) and return_immediate are available as subfields. See subfields name, push_endpoint and ack_deadline for more information.
|
||||
required: False
|
||||
name:
|
||||
name:
|
||||
description: Subfield of subscription. Required if subscription is specified. See examples.
|
||||
required: False
|
||||
ack_deadline:
|
||||
|
@ -156,13 +156,13 @@ state:
|
|||
type: str
|
||||
sample: "present"
|
||||
|
||||
subscription:
|
||||
subscription:
|
||||
description: Name of subscription.
|
||||
returned: When subscription fields are specified
|
||||
type: str
|
||||
sample: "mysubscription"
|
||||
|
||||
topic:
|
||||
topic:
|
||||
description: Name of topic.
|
||||
returned: Always
|
||||
type: str
|
||||
|
|
|
@ -45,7 +45,7 @@ options:
|
|||
state:
|
||||
description:
|
||||
- list is the only valid option.
|
||||
required: False
|
||||
required: False
|
||||
'''
|
||||
|
||||
EXAMPLES = '''
|
||||
|
@ -72,7 +72,7 @@ subscriptions:
|
|||
returned: When view is set to subscriptions.
|
||||
type: list
|
||||
sample: ["mysubscription", "mysubscription2"]
|
||||
topic:
|
||||
topic:
|
||||
description: Name of topic. Used to filter subscriptions.
|
||||
returned: Always
|
||||
type: str
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue