Right now if you pass in a preseed with a duplicated line, an exception is generated. I tried just this as the preseed:
d-i clock-setup/utc boolean true
d-i clock-setup/utc boolean true
And I got:
PYTHONPATH=/home/max/bzr/merges/bug1043419 run_utah_tests.py -i /var/cache/utah/iso/ubuntu-12.04-alternate-i386.iso -g 4 -g 4 -n /usr/share/utah/client/examples/pass.run -d -p q
INFO: Installing client deb on machine
INFO: Provisioning VM
INFO: Loading VM
INFO: Creating custom virtual machine
INFO: Preparing kernel
INFO: Unpacking kernel from image
INFO: Preparing initrd
INFO: Unpacking initrd from image
INFO: Unpacking initrd
INFO: Copying ssh public key
INFO: Creating latecommand script
INFO: Setting up preseed
Traceback (most recent call last):
File "/usr/bin/run_utah_tests.py", line 120, in <module>
run_utah_tests()
File "/usr/bin/run_utah_tests.py", line 106, in run_utah_tests
function(args=args)
File "/usr/share/utah/examples/run_install_test.py", line 96, in run_install_test
exitstatus, locallogs = run_tests(args, machine)
File "/home/max/bzr/merges/bug1043419/utah/run.py", line 32, in run_tests
machine.installclient()
File "/home/max/bzr/merges/bug1043419/utah/provisioning/provisioning.py", line 268, in installclient
self.uploadfiles([clientdeb], tmppath)
File "/home/max/bzr/merges/bug1043419/utah/provisioning/provisioning.py", line 521, in uploadfiles
self.activecheck()
File "/home/max/bzr/merges/bug1043419/utah/provisioning/vm/libvirtvm.py", line 93, in activecheck
self.provisioncheck()
File "/home/max/bzr/merges/bug1043419/utah/provisioning/provisioning.py", line 223, in provisioncheck
utah.timeout.timeout(config.installtimeout, self._provision)
File "/home/max/bzr/merges/bug1043419/utah/timeout.py", line 47, in timeout
retval = command(*args, **kw)
File "/home/max/bzr/merges/bug1043419/utah/provisioning/vm/libvirtvm.py", line 66, in _provision
self._create()
File "/home/max/bzr/merges/bug1043419/utah/provisioning/vm/libvirtvm.py", line 641, in _create
self._setuppreseed(tmpdir=tmpdir)
File "/home/max/bzr/merges/bug1043419/utah/provisioning/provisioning.py", line 776, in _setuppreseed
preseed = Preseed(self.preseed)
File "/home/max/bzr/merges/bug1043419/utah/preseed.py", line 16, in __init__
self.read(filename)
File "/home/max/bzr/merges/bug1043419/utah/preseed.py", line 60, in read
new_section = Section.new(self, output_lines)
File "/home/max/bzr/merges/bug1043419/utah/preseed.py", line 174, in new
return ConfigurationSection(parent, lines)
File "/home/max/bzr/merges/bug1043419/utah/preseed.py", line 311, in __init__
self.qname = splitted_text[1]
File "/home/max/bzr/merges/bug1043419/utah/preseed.py", line 243, in __set__
obj.property_updated(self.name, old_value, new_value)
File "/home/max/bzr/merges/bug1043419/utah/preseed.py", line 352, in property_updated
self.parent.section_updated(self, property_name, old_value, new_value)
File "/home/max/bzr/merges/bug1043419/utah/preseed.py", line 136, in section_updated
assert new_text not in self._qnames
AssertionError
@Max
The preseed parser assumes that the question name is unique for two reasons:
- access the quickly to a section in the preseed using a dictionary
- identify each section by question name (so that it's easy to update the preseed)
For example, to get the late command line, the code is: 'preseed/ late_command' ]
question = preseed[
If there were multiple late commands, we'd need to do something like this: 'preseed/ late_command' ][index]
question = preseed[
I'm not sure about what's the behavior for a preseed file when a line is duplicated. Is just the last line that one that is valid?
In such a case, I could do a couple of things:
- use only the last line, that is, keep the code as it's and just make changes to the last line
- the same as above, but remove duplicates when the final preseed is written to a file
For now, in my opinion isn't a bad thing to have an exception for duplicated question names since I thing that's possible a mistake, but if there's a use case I'm missing please let me know. Anyway, any of the fixes above would be easy to write.