ansible-vars 1.0.11__tar.gz → 1.0.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ansible-vars
3
- Version: 1.0.11
3
+ Version: 1.0.12
4
4
  Summary: Manage vaults and variable files for Ansible
5
5
  Project-URL: Homepage, https://github.com/xorwow/ansible-vars
6
6
  Project-URL: Issues, https://github.com/xorwow/ansible-vars/issues
@@ -103,7 +103,7 @@ To use any functions of `ansible-vars` that require encrypting or decrypting dat
103
103
 
104
104
  By default, the first loaded key is used for all encryption tasks. Note that auto-detected keys are inserted into the application's keyring *after* your explicitly added ones, so the first key you add will usually be the encryption key. If you want to make sure a certain key is used, reference its identifier using `--encryption-key|-K <identifier>`.
105
105
 
106
- You can disable automatic key detection by flagging `--no-encrypt-keys|-D`. Use `ansible-vars keyring` to view all available keys.
106
+ You can disable automatic key detection by flagging `--no-detect-keys|-D`. Use `ansible-vars keyring` to view all available keys.
107
107
 
108
108
  #### Encryption salts
109
109
 
@@ -81,7 +81,7 @@ To use any functions of `ansible-vars` that require encrypting or decrypting dat
81
81
 
82
82
  By default, the first loaded key is used for all encryption tasks. Note that auto-detected keys are inserted into the application's keyring *after* your explicitly added ones, so the first key you add will usually be the encryption key. If you want to make sure a certain key is used, reference its identifier using `--encryption-key|-K <identifier>`.
83
83
 
84
- You can disable automatic key detection by flagging `--no-encrypt-keys|-D`. Use `ansible-vars keyring` to view all available keys.
84
+ You can disable automatic key detection by flagging `--no-detect-keys|-D`. Use `ansible-vars keyring` to view all available keys.
85
85
 
86
86
  #### Encryption salts
87
87
 
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "ansible-vars"
7
- version = "1.0.11"
7
+ version = "1.0.12"
8
8
  authors = [
9
9
  { name="xorwow", email="pip@xorwow.de" },
10
10
  ]
@@ -263,7 +263,7 @@ class Vault():
263
263
  - `True`: Attempt to copy and convert the value('s leaf values) into an `EncryptedVar` before storing it
264
264
  - `False`: Store the value as-is
265
265
  '''
266
- path = Vault._to_path(path)
266
+ path: tuple[Hashable, ...] = Vault._to_path(path)
267
267
  # Encrypt value if necessary
268
268
  if encrypt:
269
269
  value = Vault._copy_data(value)
@@ -271,10 +271,14 @@ class Vault():
271
271
  '''Transforms strings into `EncryptedVar`s.'''
272
272
  if type(_value) is not str:
273
273
  return _value
274
+ name: str | None = str(path[-1]) if path else None
274
275
  if VaultKey.is_encrypted(_value):
275
- return EncryptedVar(_value, name=str(path[-1]))
276
- return EncryptedVar(self.keyring.encrypt(_value), name=str(path[-1]))
277
- Vault._transform_leaves(value, _encrypt_leaf, tuple()) if isinstance(value, dict | list) else _encrypt_leaf(tuple(), value)
276
+ return EncryptedVar(_value, name=name)
277
+ return EncryptedVar(self.keyring.encrypt(_value), name=name)
278
+ if isinstance(value, dict | list):
279
+ Vault._transform_leaves(value, _encrypt_leaf, tuple())
280
+ else:
281
+ value = _encrypt_leaf(tuple(), value)
278
282
  # Resolve chain and create parents if necessary, then set value for last item
279
283
  parent: Any = self._data
280
284
  par_path: str = ''
File without changes
File without changes