mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-12 23:55:19 +01:00
Compare commits
2 commits
18b044c7bb
...
044469b8e8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
044469b8e8 | ||
|
|
72646b1ea7 |
1 changed files with 3 additions and 3 deletions
|
|
@ -230,6 +230,7 @@ from operator import itemgetter
|
|||
from ansible.module_utils._text import to_native
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.urls import fetch_url
|
||||
from ansible.module_utils.six.moves.urllib.parse import urlparse
|
||||
|
||||
|
||||
class keydict(dict):
|
||||
|
|
@ -577,10 +578,9 @@ def enforce_state(module, params):
|
|||
# resp.read gives bytes on python3, convert to native string type
|
||||
key = to_native(key, errors='surrogate_or_strict')
|
||||
|
||||
file_prefix = "file://"
|
||||
if key.startswith(file_prefix):
|
||||
if key.startswith("file"):
|
||||
# if the key is an absolute path, check for existense and use it as a key source
|
||||
key_path = key[len(file_prefix):]
|
||||
key_path = urlparse(key).path
|
||||
if not os.path.exists(key_path):
|
||||
module.fail_json(msg="Path to a key file not found: %s" % key_path)
|
||||
if not os.path.isfile(key_path):
|
||||
|
|
|
|||
Loading…
Reference in a new issue