1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00

Merge remote-tracking branch 'origin/main' into secrets

This commit is contained in:
Ross McFarland
2024-03-09 14:33:53 -08:00
4 changed files with 32 additions and 1 deletions

View File

@@ -2,6 +2,12 @@
* Beta support for custom secret providers added to Manager.
## v1.5.1 - 2024-03-08 - env/* type conversion fix
* Improved env variable to parameter type conversion logic, avoid converting
all numbers to float which caused some formatting issues in things that
weren't being careful enough.
## v1.5.0 - 2024-02-26 - Checksums, nested expansion, & flexable values
* Beta support for Manager.enable_checksum and octodns-sync --checksum Allows a

View File

@@ -1,4 +1,4 @@
'OctoDNS: DNS as code - Tools for managing DNS across multiple providers'
# TODO: remove __VERSION__ w/2.x
__version__ = __VERSION__ = '1.5.0'
__version__ = __VERSION__ = '1.5.1'

View File

@@ -434,6 +434,18 @@ class Manager(object):
else:
v = handler.fetch(name, source)
if isinstance(v, str):
try:
if '.' in v:
# has a dot, try converting it to a float
v = float(v)
else:
# no dot, try converting it to an int
v = int(v)
except ValueError:
# just leave it as a string
pass
kwargs[k] = v
return kwargs

View File

@@ -1137,6 +1137,7 @@ class TestManager(TestCase):
environ['OCTODNS_TEST_1'] = '42'
environ['OCTODNS_TEST_2'] = 'string'
environ['OCTODNS_TEST_3'] = '43.44'
# empty
self.assertEqual({}, manager._build_kwargs({}))
@@ -1206,6 +1207,18 @@ class TestManager(TestCase):
),
)
# types/conversion
self.assertEqual(
{'int': 42, 'string': 'string', 'float': 43.44},
manager._build_kwargs(
{
'int': 'env/OCTODNS_TEST_1',
'string': 'env/OCTODNS_TEST_2',
'float': 'env/OCTODNS_TEST_3',
}
),
)
def test_config_secret_handlers(self):
# config doesn't matter here
manager = Manager(get_config_filename('simple.yaml'))