1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Allow equal sign in single-line ini variables

This commit is contained in:
Ilya Kuznetsov 2014-02-14 20:03:14 +07:00 committed by Ilya Kuznetsov
parent 22cfef33b4
commit 0658847ea6
3 changed files with 10 additions and 2 deletions

View file

@ -119,7 +119,7 @@ class InventoryParser(object):
if t.startswith('#'): if t.startswith('#'):
break break
try: try:
(k,v) = t.split("=") (k,v) = t.split("=", 1)
except ValueError, e: except ValueError, e:
raise errors.AnsibleError("Invalid ini entry: %s - %s" % (t, str(e))) raise errors.AnsibleError("Invalid ini entry: %s - %s" % (t, str(e)))
try: try:

View file

@ -55,7 +55,7 @@ class TestInventory(unittest.TestCase):
'thrudgelmir0', 'thrudgelmir1', 'thrudgelmir2', 'thrudgelmir0', 'thrudgelmir1', 'thrudgelmir2',
'thrudgelmir3', 'thrudgelmir4', 'thrudgelmir5', 'thrudgelmir3', 'thrudgelmir4', 'thrudgelmir5',
'Hotep-a', 'Hotep-b', 'Hotep-c', 'Hotep-a', 'Hotep-b', 'Hotep-c',
'BastC', 'BastD', ] 'BastC', 'BastD', 'neptun', ]
##################################### #####################################
### Empty inventory format tests ### Empty inventory format tests
@ -401,6 +401,11 @@ class TestInventory(unittest.TestCase):
'inventory_hostname_short': 'zeus', 'inventory_hostname_short': 'zeus',
'group_names': ['greek', 'major-god']} 'group_names': ['greek', 'major-god']}
def test_allows_equals_sign_in_var(self):
inventory = self.simple_inventory()
auth = inventory.get_variables('neptun')['auth']
assert auth == 'YWRtaW46YWRtaW4='
# test disabled as needs to be updated to model desired behavior # test disabled as needs to be updated to model desired behavior
# #
#def test_dir_inventory(self): #def test_dir_inventory(self):

View file

@ -17,3 +17,6 @@ loki
[egyptian] [egyptian]
Hotep-[a:c] Hotep-[a:c]
Bast[C:D] Bast[C:D]
[auth]
neptun auth="YWRtaW46YWRtaW4="