Revision 28dbee38 gen-config.py

View differences:

gen-config.py
10 10

  
11 11
parser = ArgumentParser()
12 12
parser.add_argument("-r", "--rspec", dest="rspec",
13
                    default="", action="store", metavar="FILENAME",
13
                    nargs='+', action="store", metavar="FILENAME",
14 14
                    help="Rspec file to be parsed")
15 15
parser.add_argument("-s", "--ssh-config", dest="ssh_config",
16 16
                    default="ssh-config", action="store", metavar="FILENAME",
......
39 39
    print("You must specify an Rspec input file")
40 40
    sys.exit(1)
41 41

  
42
rspec_file = args.rspec
42
rspec_list = args.rspec
43 43
ssh_config_file = args.ssh_config
44 44
ssh_config_no_proxy_file = ssh_config_file + "-no-proxy"
45 45
ansible_config_file = args.ansible_config
......
61 61
                               ANSIBLE_HOST_TEMPLATE, ansible_inventory_file,
62 62
                               ssh_config_file)
63 63

  
64
xml_file = ET.iterparse(rspec_file)
65
for _, el in xml_file:
64
nodes = []
65
for r in rspec_list:
66
  xml_file = ET.iterparse(r)
67
  for _, el in xml_file:
66 68
    el.tag = el.tag.split('}', 1)[1]  # strip all namespaces
69
  root = xml_file.root
70
  n = root.findall(NODE)
71
  nodes = nodes + n
67 72

  
68 73
n = 0
69
root = xml_file.root
70
nodes = root.findall(NODE)
74
#root = xml_file.root
75
#nodes = root.findall(NODE)
71 76
n_nodes = len(nodes)
72 77
name_template = NODE_NAME
73 78
for node in nodes:

Also available in: Unified diff