fix: transfert part a secretmanager in rougail

This commit is contained in:
egarette@silique.fr 2026-01-20 10:09:33 +01:00
parent 9a10e641f7
commit cd7f148963
17 changed files with 96 additions and 37 deletions

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2025 Copyright (C) 2025-2026
distribued with GPL-2 or later license distribued with GPL-2 or later license

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2025 Copyright (C) 2025-2026
distribued with GPL-2 or later license distribued with GPL-2 or later license
@ -44,7 +44,4 @@ class Annotator(Walk):
path = variable.path path = variable.path
self.objectspace.informations.add(path, "bitwarden", True) self.objectspace.informations.add(path, "bitwarden", True)
self.objectspace.informations.add(path, "default_value_makes_sense", False) self.objectspace.informations.add(path, "default_value_makes_sense", False)
if "force_default_on_freeze" in self.objectspace.properties.get(path):
self.objectspace.properties.remove(path, "force_default_on_freeze")
self.objectspace.properties.add(path, "novalidator", True)
variable.default = variable.secret_manager variable.default = variable.secret_manager

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2025 Copyright (C) 2025-2026
distribued with GPL-2 or later license distribued with GPL-2 or later license

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2025 Copyright (C) 2025-2026
distribued with GPL-2 or later license distribued with GPL-2 or later license
@ -214,7 +214,7 @@ def set_password(cache, command, *, option):
cache[key] = data.copy() cache[key] = data.copy()
if not data: if not data:
raise ConfigError( raise ConfigError(
_('item "{0}" in Bitwarden is not found"').format( _('item "{0}" in Bitwarden is not found').format(
key key
) )
) )

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2025 Copyright (C) 2025-2026
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the

View file

@ -1 +1 @@
"item \"1_secret_unknown - environment - service - user\" in Bitwarden is not found\"" "item \"1_secret_unknown - environment - service - user\" in Bitwarden is not found"

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,4 @@
{
"errors": [],
"warnings": []
}

View file

@ -0,0 +1,12 @@
{
"rougail.leader.username": [
{
"rougail.leader.username": "bitwarden_username",
"rougail.leader.secret": "bitwarden_password"
},
{
"rougail.leader.username": "bitwarden_username_2",
"rougail.leader.secret": "bitwarden_password_2"
}
]
}

View file

@ -0,0 +1,8 @@
{
"rougail.leader.username": [
{
"rougail.leader.username": "example_login",
"rougail.leader.secret": "Ex4mpL3_P4ssw0rD"
}
]
}

View file

@ -3,38 +3,17 @@
"warnings": [ "warnings": [
[ [
[ [
"item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found\", it will be ignored", "item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found, it will be ignored",
"rougail.leader.username", "rougail.leader.username",
null null
] ]
], ],
[ [
[ [
"item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found\", it will be ignored", "item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found, it will be ignored",
"rougail.leader.username", "rougail.leader.username",
null null
] ]
],
[
[
"item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found\", it will be ignored when loading from Bitwarden",
"rougail.leader.secret",
null
]
],
[
[
"item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found\", it will be ignored when loading from Bitwarden",
"rougail.leader.secret",
null
]
],
[
[
"item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found\", it will be ignored when loading from Bitwarden",
"rougail.leader.secret",
null
]
] ]
] ]
} }

View file

@ -1 +1 @@
"item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found\"" "item \"3_leadership_secret - environment - service - unknown\" in Bitwarden is not found"

View file

@ -1,6 +1,12 @@
{ {
"errors": [], "errors": [],
"warnings": [ "warnings": [
"variable or family \"rougail.modified_variable_single\" does not exist, it will be ignored when loading from By Hand" [
[
"variable or family \"modified_variable_single\" does not exist so cannot load \"rougail.modified_variable_single\", it will be ignored when loading from By Hand",
"rougail",
null
]
]
] ]
} }

View file

@ -1,6 +1,12 @@
{ {
"errors": [], "errors": [],
"warnings": [ "warnings": [
"variable or family \"rougail.modified_variable\" does not exist, it will be ignored when loading from By Hand" [
[
"variable or family \"modified_variable\" does not exist so cannot load \"rougail.modified_variable\", it will be ignored when loading from By Hand",
"rougail",
null
]
]
] ]
} }

View file

@ -1,6 +1,12 @@
{ {
"errors": [], "errors": [],
"warnings": [ "warnings": [
"variable or family \"rougail.modified_variable\" does not exist, it will be ignored when loading from By Hand" [
[
"variable or family \"modified_variable\" does not exist so cannot load \"rougail.modified_variable\", it will be ignored when loading from By Hand",
"rougail",
null
]
]
] ]
} }

View file

@ -0,0 +1,26 @@
---
version: 1.1
leader:
type: leadership
username:
description: the username
type: unix_user
secret_manager:
host: test
project: 3_leadership_secret
environment: environment
service: service
user: user
secret:
description: the secret
type: secret
secret_manager:
host: test
project: 3_leadership_secret
environment: environment
service: service
user: user
hidden: true

View file

@ -33,6 +33,7 @@ def _test_structural_files(test_dir, command, *, env=False, modified=False, mock
if modified: if modified:
generated_user_data.insert(0, {'source': 'By Hand', 'errors': [], 'warnings': [], 'values': {'rougail.modified_variable': ['user_1', 'user_2'], 'rougail.modified_variable_single': 'user_2'}}) generated_user_data.insert(0, {'source': 'By Hand', 'errors': [], 'warnings': [], 'values': {'rougail.modified_variable': ['user_1', 'user_2'], 'rougail.modified_variable_single': 'user_2'}})
errors = rougail.user_data(generated_user_data) errors = rougail.user_data(generated_user_data)
config.property.read_only()
#expected output #expected output
try: try:
config_dict = dict(config_to_dict(config.value.get())) config_dict = dict(config_to_dict(config.value.get()))
@ -119,6 +120,16 @@ def test_structural_files_2_username_secret_invalid_bw():
_test_structural_files(test_dir / '2_username_secret_invalid', 'bw') _test_structural_files(test_dir / '2_username_secret_invalid', 'bw')
def test_structural_files_3_leadership_secret_hidden_rbw():
"tests the output"
_test_structural_files(test_dir / '3_leadership_secret_hidden', 'rbw')
def test_structural_files_3_leadership_secret_hidden_bw():
"tests the output"
_test_structural_files(test_dir / '3_leadership_secret_hidden', 'bw')
def test_structural_files_3_leadership_secret_rbw(): def test_structural_files_3_leadership_secret_rbw():
"tests the output" "tests the output"
_test_structural_files(test_dir / '3_leadership_secret', 'rbw') _test_structural_files(test_dir / '3_leadership_secret', 'rbw')