Merge lp:~javier.collado/utah/bug1118581 into lp:utah

Proposed by Javier Collado
Status: Merged
Approved by: Max Brustkern
Approved revision: 812
Merged at revision: 812
Proposed branch: lp:~javier.collado/utah/bug1118581
Merge into: lp:utah
Diff against target: 25 lines (+9/-3)
1 file modified
utah/provisioning/provisioning.py (+9/-3)
To merge this branch: bzr merge lp:~javier.collado/utah/bug1118581
Reviewer Review Type Date Requested Status
Max Brustkern (community) Approve
Review via email: mp+147423@code.launchpad.net

Description of the change

This branch fixes the nested quotation problems that happen when using a list
of commands that have their own quotation marks.

To post a comment you must log in.
Revision history for this message
Max Brustkern (nuclearbob) wrote :

This looks elaborate and useful. I'm going to run a test of it.

Revision history for this message
Max Brustkern (nuclearbob) wrote :

This looks good. I've also confirmed the truncation running on my system without it.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'utah/provisioning/provisioning.py'
--- utah/provisioning/provisioning.py 2013-02-01 11:40:31 +0000
+++ utah/provisioning/provisioning.py 2013-02-08 17:01:39 +0000
@@ -868,12 +868,18 @@
868 .format(self.CHECK_LOCK_COMMAND, pkg_name, log_file)868 .format(self.CHECK_LOCK_COMMAND, pkg_name, log_file)
869 for pkg_name in config.installpackages]))869 for pkg_name in config.installpackages]))
870 postinstall_commands = (870 postinstall_commands = (
871 'sed -i -e "/^exit 0$/i{}" /etc/rc.local;'871 'sed -i -e \'/^exit 0$/i{}\' /etc/rc.local;'
872 .format(install_commands)872 .format(install_commands)
873 )873 )
874 chroot_command = ' '.join([install_commands, postinstall_commands])874 chroot_command = ' '.join([install_commands, postinstall_commands])
875 question.value.prepend('in-target sh -c \'{}\'; '875 # Note that since the chroot command is passed to sh within single
876 .format(chroot_command))876 # quotes, the single quotes inside the chroot command have to be
877 # escaped using '"'"'
878 # For more information, please refer to:
879 # http://stackoverflow.com/q/1250079/183066
880 question.value.prepend(
881 'in-target sh -c \'{}\'; '
882 .format(chroot_command.replace('\'', '\'"\'"\'')))
877 question.prepend("ubiquity ubiquity/summary note")883 question.prepend("ubiquity ubiquity/summary note")
878 question.prepend("ubiquity ubiquity/reboot boolean true")884 question.prepend("ubiquity ubiquity/reboot boolean true")
879 else:885 else:

Subscribers

People subscribed via source and target branches