Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CASMCMS-8599: Add CLI support for --include-disabled option on v2 session creation #120

Merged
merged 1 commit into from
Jun 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions cray/modules/bos/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -727,6 +727,11 @@ components:
Set to stage a session which will not immediately change the state of any components.
The "applystaged" endpoint can be called at a later time to trigger the start of this session.
default: false
include_disabled:
type: boolean
description: |
Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).
default: false
required: [operation, template_name]
additionalProperties: false
V2SessionStatus:
Expand Down Expand Up @@ -864,6 +869,10 @@ components:
A comma-separated list of nodes, representing the initial list of nodes
the session should operate against. The list will remain even if
other sessions have taken over management of the nodes.
include_disabled:
type: boolean
description: |
Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).
status:
$ref: '#/components/schemas/V2SessionStatus'
additionalProperties: false
Expand Down
59 changes: 59 additions & 0 deletions cray/modules/bos/swagger3.json
Original file line number Diff line number Diff line change
Expand Up @@ -1292,6 +1292,11 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n",
"default": false
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n",
"default": false
}
},
"required": [
Expand Down Expand Up @@ -1437,6 +1442,10 @@
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"status": {
"type": "object",
"description": "Information on the status of a session.\n",
Expand Down Expand Up @@ -1506,6 +1515,10 @@
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"status": {
"type": "object",
"description": "Information on the status of a session.\n",
Expand Down Expand Up @@ -2659,6 +2672,11 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n",
"default": false
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n",
"default": false
}
},
"required": [
Expand Down Expand Up @@ -3658,6 +3676,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down Expand Up @@ -4410,6 +4432,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down Expand Up @@ -4486,6 +4512,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down Expand Up @@ -10429,6 +10459,11 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n",
"default": false
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n",
"default": false
}
},
"required": [
Expand Down Expand Up @@ -10476,6 +10511,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down Expand Up @@ -10633,6 +10672,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down Expand Up @@ -10805,6 +10848,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down Expand Up @@ -10928,6 +10975,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down Expand Up @@ -11002,6 +11053,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down Expand Up @@ -11365,6 +11420,10 @@
"type": "boolean",
"description": "Set to stage a session which will not immediately change the state of any components. The \"applystaged\" endpoint can be called at a later time to trigger the start of this session.\n"
},
"include_disabled": {
"type": "boolean",
"description": "Set to include nodes that have been disabled as indicated in the Hardware State Manager (HSM).\n"
},
"components": {
"type": "string",
"description": "A comma-separated list of nodes, representing the initial list of nodes the session should operate against. The list will remain even if other sessions have taken over management of the nodes.\n"
Expand Down
31 changes: 31 additions & 0 deletions cray/tests/test_modules/test_bos.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,38 @@ def test_cray_bos_session_create(cli_runner, rest_mock):
}, data['body']
)

# pylint: disable=redefined-outer-name
def test_cray_bos_v2_sessions_create(cli_runner, rest_mock):
""" Test cray bos create v2 session ... happy path """
runner, cli, config = cli_runner
result = runner.invoke(
cli,
['bos', 'v2', 'sessions', 'create',
'--template-name', 'foo',
'--name', 'bar',
'--limit', 'harf,blah',
'--stage', 'true',
'--include-disabled', 'true',
'--operation', 'boot']
)
assert result.exit_code == 0
data = json.loads(result.output)
assert data['method'] == 'POST'
assert data['url'] == f'{config["default"]["hostname"]}' \
f'/apis/bos/v2/sessions'
compare_dicts(
{
'template_name': 'foo',
'name': 'bar',
'limit': 'harf,blah',
'stage': True,
'include_disabled': True,
'operation': 'boot',
},
data['body']
)

# pylint: disable=redefined-outer-name
def test_cray_bos_session_create_missing_required(cli_runner, rest_mock):
""" Test cray bos create session ... when a required parameter is missing

Expand Down