Discussion:
[Fab-user] Function with loop
Eldad Cohen
2018-09-04 11:25:57 UTC
Permalink
Hi,

How Do I run on Host a function that consists of loop and some python
commands.
How do I wrap this kind of function to run on Hosts.
Example:

import xml.etree.ElementTree as ET
tree = ET.parse("test.xml")
a = tree.find('parent')for b in a.findall('child'):
if b.text.strip() == 'Jay/Doctor':
breakelse:
ET.SubElement(a,"child").text="Jay/Doctor"
tree.write("test.xml")

Loading...