Skip to content

Commit ceaa753

Browse files
committed
fix!: replace - with _ for dummy facts
Within kayobe-automation config-diff attempts to create dummy facts for interfaces. This is fine however some interfaces may contain `-` which Ansible will convert into `_` we need to do the same otherwise it will fail when attempting to use facts with these alternative names.
1 parent 36ec290 commit ceaa753

File tree

1 file changed

+1
-1
lines changed
  • ansible/roles/config-diff-vars/filter_plugins

1 file changed

+1
-1
lines changed

ansible/roles/config-diff-vars/filter_plugins/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def dummy_facts_interfaces(context, host):
8888
interface = mapping['interface']
8989
interfaces.append(interface)
9090
ip = mapping['ip']
91-
key = "ansible_%s" % interface
91+
key = f"ansible_{interface.replace('-', '_')}"
9292
value = {"ipv4": {"address": ip}}
9393
result[key] = value
9494
result['interfaces'] = result.get('interfaces',[]) + interfaces

0 commit comments

Comments
 (0)