Port arg specs from type='str' to type='path'

This commit is contained in:
Toshio Kuratomi 2017-10-07 14:57:13 -07:00
commit 75eed6a51a
12 changed files with 27 additions and 40 deletions

View file

@ -543,7 +543,7 @@ def main():
argument_spec.update(
dict(
bucket=dict(required=True),
dest=dict(default=None),
dest=dict(default=None, type='path'),
encrypt=dict(default=True, type='bool'),
expiry=dict(default=600, type='int', aliases=['expiration']),
headers=dict(type='dict'),
@ -593,9 +593,6 @@ def main():
src = module.params.get('src')
ignore_nonexistent_bucket = module.params.get('ignore_nonexistent_bucket')
if dest:
dest = os.path.expanduser(dest)
object_canned_acl = ["private", "public-read", "public-read-write", "aws-exec-read", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control"]
bucket_canned_acl = ["private", "public-read", "public-read-write", "authenticated-read"]

View file

@ -221,9 +221,9 @@ class AzureRMStorageBlob(AzureRMModuleBase):
self.module_arg_spec = dict(
storage_account_name=dict(required=True, type='str', aliases=['account_name', 'storage_account']),
blob=dict(type='str', aliases=['blob_name']),
blob_type=dict(type='str', default='block', choices=['block','page']),
blob_type=dict(type='str', default='block', choices=['block', 'page']),
container=dict(required=True, type='str', aliases=['container_name']),
dest=dict(type='str'),
dest=dict(type='path'),
force=dict(type='bool', default=False),
resource_group=dict(required=True, type='str', aliases=['resource_group_name']),
src=dict(type='str'),
@ -296,7 +296,7 @@ class AzureRMStorageBlob(AzureRMModuleBase):
if self.src and self.src_is_valid():
if self.blob_obj and not self.force:
self.log("Cannot upload to {0}. Blob with that name already exists. "
"Use the force option".format(self.blob))
"Use the force option".format(self.blob))
else:
self.upload_blob()
elif self.dest and self.dest_is_valid():
@ -329,7 +329,7 @@ class AzureRMStorageBlob(AzureRMModuleBase):
return self.results
def get_container(self):
result = dict()
result = {}
container = None
if self.container:
try:
@ -365,7 +365,7 @@ class AzureRMStorageBlob(AzureRMModuleBase):
content_language=blob.properties.content_settings.content_language,
content_disposition=blob.properties.content_settings.content_disposition,
cache_control=blob.properties.content_settings.cache_control,
content_md5 =blob.properties.content_settings.content_md5
content_md5=blob.properties.content_settings.content_md5
)
)
return result
@ -443,8 +443,6 @@ class AzureRMStorageBlob(AzureRMModuleBase):
def dest_is_valid(self):
if not self.check_mode:
self.dest = os.path.expanduser(self.dest)
self.dest = os.path.expandvars(self.dest)
if not os.path.basename(self.dest):
# dest is a directory
if os.path.isdir(self.dest):

View file

@ -204,9 +204,9 @@ class LoginManager(DockerBaseClass):
'''
cmd = "%s logout " % self.client.module.get_bin_path('docker', True)
#TODO: docker does not support config file in logout, restore this when they do
#if self.config_path and self.config_file_exists(self.config_path):
# cmd += "--config '%s' " % self.config_path
# TODO: docker does not support config file in logout, restore this when they do
# if self.config_path and self.config_file_exists(self.config_path):
# cmd += "--config '%s' " % self.config_path
cmd += "'%s'" % self.registry_url
(rc, out, err) = self.client.module.run_command(cmd)
@ -250,7 +250,7 @@ class LoginManager(DockerBaseClass):
:return: None
'''
path = os.path.expanduser(self.config_path)
path = self.config_path
if not self.config_file_exists(path):
self.create_config_file(path)
@ -291,14 +291,14 @@ class LoginManager(DockerBaseClass):
def main():
argument_spec=dict(
argument_spec = dict(
registry_url=dict(type='str', required=False, default=DEFAULT_DOCKER_REGISTRY, aliases=['registry', 'url']),
username=dict(type='str', required=False),
password=dict(type='str', required=False, no_log=True),
email=dict(type='str'),
reauthorize=dict(type='bool', default=False, aliases=['reauth']),
state=dict(type='str', default='present', choices=['present', 'absent']),
config_path=dict(type='str', default='~/.docker/config.json', aliases=['self.config_path', 'dockercfg_path']),
config_path=dict(type='path', default='~/.docker/config.json', aliases=['self.config_path', 'dockercfg_path']),
)
required_if = [

View file

@ -124,7 +124,6 @@ from ansible.module_utils.rax import rax_argument_spec, rax_clb_node_to_dict, ra
def _activate_virtualenv(path):
path = os.path.expanduser(path)
activate_this = os.path.join(path, 'bin', 'activate_this.py')
with open(activate_this) as f:
code = compile(f.read(), activate_this, 'exec')
@ -159,7 +158,7 @@ def main():
port=dict(type='int'),
state=dict(default='present', choices=['present', 'absent']),
type=dict(choices=['primary', 'secondary']),
virtualenv=dict(),
virtualenv=dict(type='path'),
wait=dict(default=False, type='bool'),
wait_timeout=dict(default=30, type='int'),
weight=dict(type='int'),