-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from asm0deuz/fix_ci_test
Fixing all CI errors
- Loading branch information
Showing
19 changed files
with
587 additions
and
204 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
--- | ||
requires_ansible: ">=2.14.0" | ||
requires_ansible: ">=2.15.0" |
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 |
---|---|---|
|
@@ -3,18 +3,8 @@ | |
# Author: Guillaume Abrioux <[email protected]> | ||
|
||
from __future__ import absolute_import, division, print_function | ||
from typing import Any, Dict, List, Tuple, Union | ||
__metaclass__ = type | ||
|
||
import datetime | ||
import json | ||
|
||
from ansible.module_utils.basic import AnsibleModule # type: ignore | ||
try: | ||
from ansible_collections.ceph.automation.plugins.module_utils.ceph_common import exit_module, build_base_cmd_shell, fatal # type: ignore | ||
except ImportError: | ||
from module_utils.ceph_common import exit_module, build_base_cmd_shell, fatal # type: ignore | ||
|
||
ANSIBLE_METADATA = { | ||
'metadata_version': '1.1', | ||
'status': ['preview'], | ||
|
@@ -25,38 +15,45 @@ | |
--- | ||
module: ceph_config | ||
short_description: set ceph config | ||
version_added: "2.10" | ||
version_added: "1.0.0" | ||
description: | ||
- Set Ceph config options. | ||
options: | ||
fsid: | ||
description: | ||
- the fsid of the Ceph cluster to interact with. | ||
type: str | ||
required: false | ||
image: | ||
description: | ||
- The Ceph container image to use. | ||
type: str | ||
required: false | ||
action: | ||
description: | ||
- whether to get or set the parameter specified in 'option' | ||
required: false | ||
type: str | ||
choices: ['get', 'set'] | ||
default: 'set' | ||
who: | ||
description: | ||
- which daemon the configuration should be set to | ||
type: str | ||
required: true | ||
option: | ||
description: | ||
- name of the parameter to be set | ||
type: str | ||
required: true | ||
value: | ||
description: | ||
- value of the parameter | ||
required: true if action is 'set' | ||
type: str | ||
required: false | ||
author: | ||
- Guillaume Abrioux <[email protected]> | ||
- guillaume abrioux (@guits) | ||
''' | ||
|
||
EXAMPLES = ''' | ||
|
@@ -84,6 +81,16 @@ | |
|
||
RETURN = '''# ''' | ||
|
||
from typing import Any, Dict, List, Tuple, Union | ||
from ansible.module_utils.basic import AnsibleModule # type: ignore | ||
try: | ||
from ansible_collections.ceph.automation.plugins.module_utils.ceph_common import exit_module, build_base_cmd_shell, fatal # type: ignore | ||
except ImportError: | ||
from module_utils.ceph_common import exit_module, build_base_cmd_shell, fatal # type: ignore | ||
|
||
import datetime | ||
import json | ||
|
||
|
||
def set_option(module: "AnsibleModule", | ||
who: str, | ||
|
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 |
---|---|---|
|
@@ -15,19 +15,8 @@ | |
# limitations under the License. | ||
|
||
from __future__ import absolute_import, division, print_function | ||
from typing import List, Tuple, Dict | ||
__metaclass__ = type | ||
|
||
import datetime | ||
import yaml | ||
|
||
from ansible.module_utils.basic import AnsibleModule # type: ignore | ||
try: | ||
from ansible_collections.ceph.automation.plugins.module_utils.ceph_common import exit_module, build_base_cmd_orch # type: ignore | ||
except ImportError: | ||
from module_utils.ceph_common import exit_module, build_base_cmd_orch | ||
|
||
|
||
ANSIBLE_METADATA = { | ||
'metadata_version': '1.1', | ||
'status': ['preview'], | ||
|
@@ -38,24 +27,33 @@ | |
--- | ||
module: ceph_orch_apply | ||
short_description: apply service spec | ||
version_added: "2.9" | ||
version_added: "1.0.0" | ||
description: | ||
- apply a service spec | ||
options: | ||
fsid: | ||
description: | ||
- the fsid of the Ceph cluster to interact with. | ||
type: str | ||
required: false | ||
image: | ||
description: | ||
- The Ceph container image to use. | ||
type: str | ||
required: false | ||
docker: | ||
description: | ||
- Use docker instead of podman | ||
type: bool | ||
required: false | ||
default: false | ||
spec: | ||
description: | ||
- The service spec to apply | ||
type: str | ||
required: true | ||
author: | ||
- Guillaume Abrioux <[email protected]> | ||
- Guillaume Abrioux (@guits) | ||
''' | ||
|
||
EXAMPLES = ''' | ||
|
@@ -71,6 +69,28 @@ | |
all: true | ||
''' | ||
|
||
RETURN = '''# ''' | ||
|
||
import traceback | ||
from ansible.module_utils.basic import missing_required_lib | ||
try: | ||
import yaml | ||
except ImportError: | ||
HAS_ANOTHER_LIBRARY = False | ||
ANOTHER_LIBRARY_IMPORT_ERROR = traceback.format_exc() | ||
else: | ||
HAS_ANOTHER_LIBRARY = True | ||
ANOTHER_LIBRARY_IMPORT_ERROR = None | ||
|
||
from typing import List, Tuple, Dict | ||
import datetime | ||
|
||
from ansible.module_utils.basic import AnsibleModule # type: ignore | ||
try: | ||
from ansible_collections.ceph.automation.plugins.module_utils.ceph_common import exit_module, build_base_cmd_orch # type: ignore | ||
except ImportError: | ||
from module_utils.ceph_common import exit_module, build_base_cmd_orch | ||
|
||
|
||
def parse_spec(spec: str) -> Dict: | ||
""" parse spec string to yaml """ | ||
|
@@ -123,7 +143,7 @@ def run_module() -> None: | |
module_args = dict( | ||
spec=dict(type='str', required=True), | ||
fsid=dict(type='str', required=False), | ||
docker=dict(type=bool, | ||
docker=dict(type='bool', | ||
required=False, | ||
default=False), | ||
image=dict(type='str', required=False) | ||
|
@@ -134,6 +154,11 @@ def run_module() -> None: | |
supports_check_mode=True | ||
) | ||
|
||
if not HAS_ANOTHER_LIBRARY: | ||
module.fail_json( | ||
msg=missing_required_lib('another_library'), | ||
exception=ANOTHER_LIBRARY_IMPORT_ERROR) | ||
|
||
startd = datetime.datetime.now() | ||
spec = module.params.get('spec') | ||
|
||
|
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 |
---|---|---|
|
@@ -3,18 +3,8 @@ | |
# Author: Guillaume Abrioux <[email protected]> | ||
|
||
from __future__ import absolute_import, division, print_function | ||
from typing import List, Tuple | ||
__metaclass__ = type | ||
|
||
import datetime | ||
import json | ||
|
||
from ansible.module_utils.basic import AnsibleModule # type: ignore | ||
try: | ||
from ansible_collections.ceph.automation.plugins.module_utils.ceph_common import retry, exit_module, build_base_cmd_orch, fatal # type: ignore | ||
except ImportError: | ||
from module_utils.ceph_common import retry, exit_module, build_base_cmd_orch, fatal # type: ignore | ||
|
||
ANSIBLE_METADATA = { | ||
'metadata_version': '1.1', | ||
'status': ['preview'], | ||
|
@@ -25,36 +15,51 @@ | |
--- | ||
module: ceph_orch_daemon | ||
short_description: stop/start daemon | ||
version_added: "2.9" | ||
version_added: "1.0.0" | ||
description: | ||
- Start, stop or restart ceph daemon | ||
options: | ||
fsid: | ||
description: | ||
- the fsid of the Ceph cluster to interact with. | ||
type: str | ||
required: false | ||
image: | ||
description: | ||
- The Ceph container image to use. | ||
type: str | ||
required: false | ||
docker: | ||
description: | ||
- Use docker instead of podman | ||
type: bool | ||
default: false | ||
required: false | ||
state: | ||
description: | ||
- The desired state of the service specified in 'name'. | ||
If 'started', it ensures the service is started. | ||
If 'stopped', it ensures the service is stopped. | ||
If 'restarted', it will restart the service. | ||
choices: | ||
- started | ||
- stopped | ||
- restarted | ||
type: str | ||
required: True | ||
daemon_id: | ||
description: | ||
- The id of the service. | ||
type: str | ||
required: true | ||
daemon_type: | ||
description: | ||
- The type of the service. | ||
type: str | ||
required: true | ||
author: | ||
- Guillaume Abrioux <[email protected]> | ||
- Guillaume Abrioux (@guits) | ||
''' | ||
|
||
EXAMPLES = ''' | ||
|
@@ -73,6 +78,16 @@ | |
|
||
RETURN = '''# ''' | ||
|
||
from ansible.module_utils.basic import AnsibleModule # type: ignore | ||
try: | ||
from ansible_collections.ceph.automation.plugins.module_utils.ceph_common import retry, exit_module, build_base_cmd_orch, fatal # type: ignore | ||
except ImportError: | ||
from module_utils.ceph_common import retry, exit_module, build_base_cmd_orch, fatal # type: ignore | ||
|
||
from typing import List, Tuple | ||
import datetime | ||
import json | ||
|
||
|
||
def get_current_state(module: "AnsibleModule", | ||
daemon_type: str, | ||
|
@@ -97,7 +112,7 @@ def update_daemon_status(module: "AnsibleModule", | |
return rc, cmd, out, err | ||
|
||
|
||
@retry(RuntimeError) | ||
@retry(RuntimeError, AnsibleModule) | ||
def validate_updated_status(module: "AnsibleModule", | ||
action: str, | ||
daemon_type: str, | ||
|
@@ -116,7 +131,7 @@ def main() -> None: | |
choices=['started', 'stopped', 'restarted']), | ||
daemon_id=dict(type='str', required=True), | ||
daemon_type=dict(type='str', required=True), | ||
docker=dict(type=bool, | ||
docker=dict(type='bool', | ||
required=False, | ||
default=False), | ||
fsid=dict(type='str', required=False), | ||
|
Oops, something went wrong.