Because I'm running into this MIXLIB-11 error that I've reported to Mixlib team, I need to find a walkaround, an alternative to Mixlib::Shellout.
Briefly about the problem:
Here is a statement which says "*No surprise -- the read is happening at compile time, but the remote_file resource is actually created at execution time.**"
Because of this feature, Mixlib::Shellout.new("ls", :cwd => '/opt/cubrid/share/webmanager')
raises "No such file or directory" error even though that directory is created at execution time by a previous recipe included in this current recipe.
Is there a way to read a file/directory at execution time?
Found an answer: wrap the code in ruby_block
, and it will be executed at run time.
ruby_block "Check if CURBID Web Manager needs installation" do
block do
version = ""
if File.exists?("#{CWM_HOME_DIR}/appLoader.js")
# Read the CWM version from file.
f = File.open("#{CWM_HOME_DIR}/appLoader.js")
pattern = /Ext\.cwm\.prodVersion = '(\d+\.\d+\.\d+\.\d+)'/
f.each {|line|
if match = pattern.match(line)
version = match[1]
break
end
}
f.close
end
end
end
Now the version is correctly populated from the file created in the previous recipe.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With