Skip to content

Commit

Permalink
Merge branch 'hotfix/2.6' into update-2.x-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau authored Apr 11, 2024
2 parents f5ae3b4 + 0f7a56d commit d79f4f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions charmcraft/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ def validate_actions(cls, options):
if "type" not in option:
raise ValueError(f"'{name}' is missing a type")

if option["type"] not in ["string", "int", "float", "boolean"]:
if option["type"] not in ["string", "int", "float", "boolean", "secret"]:
raise ValueError(
f"'{option}' has an invalid type '{option['type']}', "
"must be one of: string, int, float, boolean"
"must be one of: string, int, float, boolean, secret"
)

return options
8 changes: 8 additions & 0 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,8 @@ def test_load_config_in_charmcraft_yaml(tmp_path, prepare_charmcraft_yaml):
test-bool:
default: true
type: boolean
test-secret:
type: secret
"""
)
)
Expand All @@ -1146,6 +1148,7 @@ def test_load_config_in_charmcraft_yaml(tmp_path, prepare_charmcraft_yaml):
"test-string": {"description": "test-2", "type": "string"},
"test-float": {"default": 1.23, "type": "float"},
"test-bool": {"default": True, "type": "boolean"},
"test-secret": {"type": "secret"},
},
}

Expand Down Expand Up @@ -1179,6 +1182,8 @@ def test_load_config_in_config_yaml(tmp_path, prepare_charmcraft_yaml, prepare_c
test-bool:
default: true
type: boolean
test-secret:
type: secret
"""
),
)
Expand All @@ -1190,6 +1195,7 @@ def test_load_config_in_config_yaml(tmp_path, prepare_charmcraft_yaml, prepare_c
"test-string": {"description": "test-2", "type": "string"},
"test-float": {"default": 1.23, "type": "float"},
"test-bool": {"default": True, "type": "boolean"},
"test-secret": {"type": "secret"},
},
}

Expand Down Expand Up @@ -1248,6 +1254,8 @@ def test_load_bad_config_in_charmcraft_yaml(tmp_path, prepare_charmcraft_yaml):
test-bool:
default: true
type: boolean
test-secret:
type: secret
"""
)
)
Expand Down

0 comments on commit d79f4f0

Please sign in to comment.