-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Compatibility with Horizon 2.4 --------- Co-authored-by: AdrienDucourthial <[email protected]> Co-authored-by: Antonin <[email protected]> Co-authored-by: Soufiane Bouarfa <[email protected]> Co-authored-by: KT0 <[email protected]>
- Loading branch information
1 parent
2703578
commit 2cf981b
Showing
32 changed files
with
2,038 additions
and
566 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import os | ||
import re | ||
|
||
# Adding captions in index file | ||
with open('rst/index.rst', 'r') as file: | ||
content = file.read() | ||
content = re.sub(r':hidden:\n.*\n( +)horizon_', r':hidden:\n\g<1>:caption: Module:\n\n\g<1>horizon_', content, 1) | ||
content = re.sub(r':hidden:\n.*\n( +)horizon_', r':hidden:\n\g<1>:caption: Inventory:\n\n\g<1>horizon_', content, 1) | ||
content = re.sub(r':hidden:\n.*\n( +)horizon_', r':hidden:\n\g<1>:caption: Lookup:\n\n\g<1>horizon_', content, 1) | ||
with open('rst/index.rst', 'w') as file: | ||
file.write(content) | ||
|
||
# Removing signature from titles | ||
for file_name in os.listdir("rst"): | ||
if file_name.startswith("horizon_") : | ||
# Must remove signature title | ||
with open('rst/' + file_name, 'r') as file: | ||
content = file.read() | ||
content = re.sub(r'(\.\. Title)\n.*\n.*?-- (.*?)', r'\g<1>\n\n\g<2>', content, 1) | ||
with open('rst/' + file_name, 'w') as file: | ||
file.write(content) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/python | ||
# -*- coding: utf-8 -*- | ||
|
||
# Standard base includes and define this as a metaclass of type | ||
from __future__ import (absolute_import, division, print_function) | ||
|
||
__metaclass__ = type | ||
|
||
from ansible.errors import AnsibleError | ||
from ansible_collections.evertrust.horizon.plugins.module_utils.horizon_action import HorizonAction | ||
from ansible_collections.evertrust.horizon.plugins.module_utils.horizon_crypto import HorizonCrypto | ||
from ansible_collections.evertrust.horizon.plugins.module_utils.horizon_errors import HorizonError | ||
|
||
|
||
class ActionModule(HorizonAction): | ||
TRANSFERS_FILES = True | ||
|
||
def _args(self): | ||
return ['certificate_id', 'certificate_pem', 'password'] | ||
|
||
def run(self, tmp=None, task_vars=None): | ||
result = super(ActionModule, self).run(tmp, task_vars) | ||
|
||
try: | ||
client = self._get_client() | ||
content = self._get_content() | ||
response = client.renew(**content) | ||
|
||
if "certificate" in response: | ||
result["certificate"] = response["certificate"] | ||
result["chain"] = client.chain(result["certificate"]["certificate"]) | ||
|
||
if "pkcs12" in response.keys(): | ||
result["p12"] = response["pkcs12"]["value"] | ||
result["p12_password"] = response["password"]["value"] | ||
result["key"] = HorizonCrypto.get_key_from_p12(response["pkcs12"]["value"], | ||
response["password"]["value"]) | ||
|
||
except HorizonError as e: | ||
raise AnsibleError(e.full_message) | ||
|
||
return result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.