Compare commits

..

No commits in common. "b332195ef3e43af293272eb1e83bbafc85718d34" and "52a56476d39849fe99a9af5075f8adc53d5374e6" have entirely different histories.

8 changed files with 11 additions and 46 deletions

View file

@ -1,9 +1,3 @@
## 0.1.0a6 (2025-02-13)
### Fix
- bitwarden key could be an invalid username/secret
## 0.1.0a5 (2025-02-13)
### Fix

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail.user_data_bitwarden"
version = "0.1.0a6"
version = "0.1.0a5"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "Rougail user_data Bitwarden"

View file

@ -42,25 +42,23 @@ class Annotator(Walk):
for variable in self.get_variables():
if not variable.bitwarden:
continue
path = variable.path
if variable.type not in ["unix_user", "secret"]:
msg = _('only "unix_user" or "secret" variable type can have "bitwarden" attribute, but "{0}" has type "{1}"')
raise DictConsistencyError(msg.format(path, variable.type), 301, variable.xmlfiles)
if variable.multi and path not in self.objectspace.leaders:
raise DictConsistencyError(msg.format(variable.path, variable.type), 301, variable.xmlfiles)
if variable.multi and variable.path not in self.objectspace.leaders:
msg = _('the variable "{0}" has attribute "bitwarden" but is a multi variable')
raise DictConsistencyError(msg.format(path), 302, variable.xmlfiles)
raise DictConsistencyError(msg.format(variable.path), 302, variable.xmlfiles)
check_default_value = True
if path in self.objectspace.followers:
leadership = path.rsplit('.', 1)[0]
if variable.path in self.objectspace.followers:
leadership = variable.path.rsplit('.', 1)[0]
leader_path = self.objectspace.parents[leadership][0]
leader = self.objectspace.paths[leader_path]
if leader.bitwarden:
if variable.default:
msg = _('the variable "{0}" is a follower and leader variable ("{1}") is also in Bitwarden so this variable could not have default value')
raise DictConsistencyError(msg.format(path, leader_path), 303, variable.xmlfiles)
raise DictConsistencyError(msg.format(variable.path, leader_path), 303, variable.xmlfiles)
check_default_value = False
if check_default_value and not variable.default:
msg = _('the variable "{0}" is in Bitwarden so should have default value')
raise DictConsistencyError(msg.format(path), 304, variable.xmlfiles)
self.objectspace.informations.add(path, "bitwarden", True)
self.objectspace.properties.add(path, "novalidator", True)
raise DictConsistencyError(msg.format(variable.path), 304, variable.xmlfiles)
self.objectspace.informations.add(variable.path, "bitwarden", True)

View file

@ -75,9 +75,9 @@ class RougailUserDataBitwarden:
if option.isleader():
leader_values = []
self.leader_informations[path] = []
values = option.value.get()
for val in values:
for val in option.value.get():
names, values = self.get_values(path, type_, val, allow_multiple=True)
print(names, values)
if isinstance(values, list):
leader_values.extend(values)
self.leader_informations[path].extend(names)

View file

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

View file

@ -1,4 +0,0 @@
{
"rougail.username": "up_secret_error_1",
"rougail.secret": "up_secret_error_pass_1"
}

View file

@ -1,14 +0,0 @@
---
version: 1.1
username:
description: the username
type: unix_user
default: UP SECRET 1
bitwarden: true
secret:
description: the secret
type: secret
default: UP SECRET 1
bitwarden: true

View file

@ -60,11 +60,6 @@ def test_dictionaries_2_username_secret():
_test_dictionaries(test_dir / '2_username_secret')
def test_dictionaries_2_username_secret_invalid():
"tests the output"
_test_dictionaries(test_dir / '2_username_secret_invalid')
def test_dictionaries_3_leadership_secret():
"tests the output"
_test_dictionaries(test_dir / '3_leadership_secret')