mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
fixup appearances of config_directory, remove slash, remove hardcoded /etc/bprobe
This commit is contained in:
parent
445c888464
commit
56813c030f
1 changed files with 3 additions and 3 deletions
|
@ -149,7 +149,7 @@ def create_meter(module, name, apiid, apikey):
|
||||||
for cert_type in types:
|
for cert_type in types:
|
||||||
try:
|
try:
|
||||||
# If we can't open the file it's not there, so we should download it
|
# If we can't open the file it's not there, so we should download it
|
||||||
cert_file = open('/etc/bprobe/{cert_type}.pem'.format(cert_type=cert_type))
|
cert_file = open('{config_directory}/{cert_type}.pem'.format(config_directory=config_directory,cert_type=cert_type))
|
||||||
except IOError:
|
except IOError:
|
||||||
# Now download the file...
|
# Now download the file...
|
||||||
rc = download_request(module, name, apiid, apikey, cert_type)
|
rc = download_request(module, name, apiid, apikey, cert_type)
|
||||||
|
@ -201,7 +201,7 @@ def delete_meter(module, name, apiid, apikey):
|
||||||
types = ['cert', 'key']
|
types = ['cert', 'key']
|
||||||
for cert_type in types:
|
for cert_type in types:
|
||||||
try:
|
try:
|
||||||
cert_file = '/{config_directory}/{cert_type}.pem'.format(config_directory=config_directory,cert_type=cert_type)
|
cert_file = '{config_directory}/{cert_type}.pem'.format(config_directory=config_directory,cert_type=cert_type)
|
||||||
os.remove(cert_file)
|
os.remove(cert_file)
|
||||||
except OSError, e: ## if failed, report it back to the user ##
|
except OSError, e: ## if failed, report it back to the user ##
|
||||||
module.fail_json("Failed to remove " + cert_type + ".pem file")
|
module.fail_json("Failed to remove " + cert_type + ".pem file")
|
||||||
|
@ -223,7 +223,7 @@ def download_request(module, name, apiid, apikey, cert_type):
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
try:
|
try:
|
||||||
cert_file_path = '/{config_directory}/{cert_type}.pem'.format(config_directory=config_directory,cert_type=cert_type)
|
cert_file_path = '{config_directory}/{cert_type}.pem'.format(config_directory=config_directory,cert_type=cert_type)
|
||||||
body = result.read()
|
body = result.read()
|
||||||
cert_file = open(cert_file_path, 'w')
|
cert_file = open(cert_file_path, 'w')
|
||||||
cert_file.write(body)
|
cert_file.write(body)
|
||||||
|
|
Loading…
Reference in a new issue