Open leftys opened 9 years ago
Can you check if you're able to reproduce the error by removing the id => 102
parameter?
Yes,
I have solved it by:
index 66c4b09..2771c1b 100644
--- a/modules/virt/lib/puppet/provider/virt/openvz.rb
+++ b/modules/virt/lib/puppet/provider/virt/openvz.rb
@@ -140,10 +141,16 @@ Puppet::Type.type(:virt).provide(:openvz) do
end
def exists?
+ conf = @@vzconf + ctid.to_s + '.conf'
+ if !File.exists?(conf)
+ return false
+ end
stat = vzctl('status', ctid).split(" ")
if stat.nil? || stat[2] == "deleted"
return false
else
return true
end
end
@@ -194,7 +201,10 @@ Puppet::Type.type(:virt).provide(:openvz) do
private
def get_value(arg)
debug "Getting parameter #{arg} value"
- conf = @@vzconf + ctid + '.conf'
+ conf = @@vzconf + ctid.to_s + '.conf'
+ if !File.exists?(conf)
+ return :absent
+ end
value = open(conf).grep(/^#{arg.upcase}/)
result = value.size == 0 ? '' : value[0].split('"')[1].downcase
result
Maybe puppet behavior changed in v3 and it queries the values before creating the resource virt? I encountered a lot more problems, so I will do a pull request after I resolve them. (Now ip addreses are not assigned.)
Ehm. I had used the much older forge version. Now everything works. It would be nice to upgrade or delete it there, it didn't work for me at all...
I tried to create a VM:
and somehow, the agent tries to obtain the value of memory size before creating the vm and the config file. I obtained the following backtrace: