Johnny Brown
Johnny Brown

Reputation: 1000

Chef resource skipped even though not_if command exits 2

The resource has a not_if guard, and I've verified that the exit code from the command is non-zero. Yet the output of the chef run shows that the resource is skipped due to not_if.

The resource looks like

device_id = "/dev/xvdf"
execute 'yes | mkfs -t ext4 #{device_id}' do
    not_if 'blkid -o value -s TYPE #{device_id} && blkid -o value -s TYPE #{device_id} | grep ext4'
    timeout 1200
end

Upvotes: 1

Views: 1013

Answers (1)

Johnny Brown
Johnny Brown

Reputation: 1000

Sigh. Ruby doesn't interpolate in single-quote strings. Changed them to double quote and fixed the issue.

Upvotes: 2

Related Questions