Issue #5478 has been updated by Garrett Honeycutt. Assignee deleted (Garrett Honeycutt)
---------------------------------------- Bug #5478: shell commands not parsed correctly or shell functionality lost https://projects.puppetlabs.com/issues/5478 Author: Francis Smith Status: Duplicate Priority: Normal Assignee: Category: exec Target version: Affected Puppet version: 2.6.3 Keywords: Branch: I wrote a recipe to do LVM manipulation. The mountpoint is not known. The $name is not known The size is not known The file system is not known Etc.. etc.. etc After figuring out whether size != -1 (IE not filling the rest of the disk...) and after the LVM LV was expanded, I did the following: exec { "size-ext3-$volgroup/$title": command => "/sbin/resize2fs -p /dev/$volgroup/$title", path => "/bin:/usr/bin:/usr/sbin:/sbin", unless => "BLOCK_COUNT=`tune2fs -l /dev/$volgroup/$title |grep -i '^Block Count'|awk '{print \$3}'`;BLOCK_SIZE=`tune2fs -l /dev/$volgroup/$title|grep -i '^Block size'| awk '{print \$3}'`;FS_SIZE=$((\$BLOCK_COUNT*\$BLOCK_SIZE/1024 ));LV_SIZE=`lvdisplay /dev/$volgroup/$title --units k | grep 'LV Size' | awk '{print \$3}' | sed 's/.00//g'`; test \$LV_SIZE == \$FS_SIZE", timeout => 7200, require => [ Exec["lvm-lv-$volgroup/$title-size-$size"], Exec["mkfs.ext3-$volgroup/$title"] ]; } **This worked in 2.5.4 :: This does not work in 2.6.3** **I had to rewrite the 2.5.4 code to the following to get it to work ::** SOLUTION: I made all lines as single commands... so, here is an example exec { "size-ext3-$volgroup/$title": command => "/sbin/resize2fs -p /dev/$volgroup/$title", path => "/bin:/usr/bin:/usr/sbin:/sbin", unless => "/usr/bin/test \$[`(lvdisplay /dev/$volgroup/$title --units k | /bin/grep 'LV Size' | /bin/awk '{print \$3}' | /bin/sed 's/.00//g')`] == \$[`(tune2fs -l /dev/$volgroup/$title |/bin/grep -i '^Block Count'|awk '{print \$3}')` * `(tune2fs -l /dev/$volgroup/$title|/bin/grep -i '^Block size'| /bin/awk '{print \$3}')` /1024 ]", timeout => 3600, require => Exec["mkfs.ext3-$volgroup/$title"]; } As you will see, the unless is all one single command The frustrating part is that in 2.5, this unless worked. I feel this new way of parsing shell commands is restrictive, and causes code to not be backwards compatible. -- You have received this notification because you have either subscribed to it, or are involved in it. To change your notification preferences, please click here: http://projects.puppetlabs.com/my/account -- You received this message because you are subscribed to the Google Groups "Puppet Bugs" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/puppet-bugs?hl=en.
