Closed hlawatschek closed 5 years ago
I can confirm this error. I have the same one with version 0.8 and with Proxmox 5.3 and 5.4
I have the same error. With Proxmox 5.4 and 6 Everyone fixed?
and under Proxmox 5.1 the same problem.
any workaround yet, anyone?
same problem 5.3 and 6.0
you might want to try this "workaround"
diff --git a/app/models/foreman_fog_proxmox/proxmox.rb b/app/models/foreman_fog_proxmox/proxmox.rb
index d428ba9..223a259 100644
--- a/app/models/foreman_fog_proxmox/proxmox.rb
+++ b/app/models/foreman_fog_proxmox/proxmox.rb
@@ -145,8 +145,9 @@ module ForemanFogProxmox
mac = nic.mac
mac = nic.attributes['mac'] unless mac
nic_compute_attributes.store(:macaddr, mac) if (mac && !mac.empty?)
- interface_compute_attributes = host.compute_attributes['interfaces_attributes'].select { |_k,v| v['id'] == nic.identifier }
- nic_compute_attributes.store(:_delete, interface_compute_attributes[interface_compute_attributes.keys[0]]['_delete']) unless interface_compute_attributes.empty?
+ #Workaround? for #89
+ #interface_compute_attributes = host.compute_attributes['interfaces_attributes'].select { |_k,v| v['id'] == nic.identifier }
+ #nic_compute_attributes.store(:_delete, interface_compute_attributes[interface_compute_attributes.keys[0]]['_delete']) unless interface_compute_attributes.empty?
nic_compute_attributes.store(:ip, nic.ip) if (nic.ip && !nic.ip.empty?)
nic_compute_attributes.store(:ip6, nic.ip6) if (nic.ip6 && !nic.ip6.empty?)
hash.merge(index.to_s => nic_compute_attributes)
--
2.20.1
you might want to try this "workaround"
diff --git a/app/models/foreman_fog_proxmox/proxmox.rb b/app/models/foreman_fog_proxmox/proxmox.rb index d428ba9..223a259 100644 --- a/app/models/foreman_fog_proxmox/proxmox.rb +++ b/app/models/foreman_fog_proxmox/proxmox.rb @@ -145,8 +145,9 @@ module ForemanFogProxmox mac = nic.mac mac = nic.attributes['mac'] unless mac nic_compute_attributes.store(:macaddr, mac) if (mac && !mac.empty?) - interface_compute_attributes = host.compute_attributes['interfaces_attributes'].select { |_k,v| v['id'] == nic.identifier } - nic_compute_attributes.store(:_delete, interface_compute_attributes[interface_compute_attributes.keys[0]]['_delete']) unless interface_compute_attributes.empty? + #Workaround? for #89 + #interface_compute_attributes = host.compute_attributes['interfaces_attributes'].select { |_k,v| v['id'] == nic.identifier } + #nic_compute_attributes.store(:_delete, interface_compute_attributes[interface_compute_attributes.keys[0]]['_delete']) unless interface_compute_attributes.empty? nic_compute_attributes.store(:ip, nic.ip) if (nic.ip && !nic.ip.empty?) nic_compute_attributes.store(:ip6, nic.ip6) if (nic.ip6 && !nic.ip6.empty?) hash.merge(index.to_s => nic_compute_attributes) -- 2.20.1
diff: Unbekannte Option »--git« diff: »diff --help« gibt Ihnen mehr Informationen.
i have an error by use:
diff --git a/app/models/foreman_fog_proxmox/proxmox.rb b/app/models/foreman_fog_proxmox/proxmox.rb
You can just comment out the two lines in app/models/foreman_fog_proxmox/proxmox.rb should be around line 148.
#interface_compute_attributes = host.compute_attributes['interfaces_attributes'].select { |_k,v| v['id'] == nic.identifier }
#nic_compute_attributes.store(:_delete, interface_compute_attributes[interface_compute_attributes.keys[0]]['_delete']) unless interface_compute_attributes.empty?
where do I have to do that? I have the plugin installed. where can i find this file?
app/models/foreman_fog_proxmox/proxmox.rb
where do I have to do that? I have the plugin installed. where can i find this file?
app/models/foreman_fog_proxmox/proxmox.rb
there or?
/usr/share/foreman/vendor/ruby/2.3.0/gems/fog-proxmox-0.8.0/lib/fog
@hlawatschek confirmed, the workaround works, thanks!
At least it works with VMs (not LXCs)
can you explain how you did it exactly please?
@MarvinMedia just like @hlawatschek suggested: comment out 2 lines in proxmox.rb: the one that resides under app/models/foreman_fog_proxmox
. Not sure about your OS and ruby version, but if you're in Ubuntu then it's, most likely:
/usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb
and if you're on CentOS (and the likes), then it's: /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb
Now, this "workaround" does appear to allow provisioning VMs, but there might be some other issues down the line.
@MarvinMedia just like @hlawatschek suggested: comment out 2 lines in proxmox.rb: the one that resides under
app/models/foreman_fog_proxmox
. Not sure about your OS and ruby version, but if you're in Ubuntu than it's: /usr/share/foreman/vendor/ruby/2.5.0/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rband if you're on CentOS (and the likes), then it's /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb
Now, this "workaround" does appear to allow provisioning VMs, but there might be some other issues down the line.
thank you very much.
you might want to try this "workaround"
diff --git a/app/models/foreman_fog_proxmox/proxmox.rb b/app/models/foreman_fog_proxmox/proxmox.rb index d428ba9..223a259 100644 --- a/app/models/foreman_fog_proxmox/proxmox.rb +++ b/app/models/foreman_fog_proxmox/proxmox.rb @@ -145,8 +145,9 @@ module ForemanFogProxmox mac = nic.mac mac = nic.attributes['mac'] unless mac nic_compute_attributes.store(:macaddr, mac) if (mac && !mac.empty?) - interface_compute_attributes = host.compute_attributes['interfaces_attributes'].select { |_k,v| v['id'] == nic.identifier } - nic_compute_attributes.store(:_delete, interface_compute_attributes[interface_compute_attributes.keys[0]]['_delete']) unless interface_compute_attributes.empty? + #Workaround? for #89 + #interface_compute_attributes = host.compute_attributes['interfaces_attributes'].select { |_k,v| v['id'] == nic.identifier } + #nic_compute_attributes.store(:_delete, interface_compute_attributes[interface_compute_attributes.keys[0]]['_delete']) unless interface_compute_attributes.empty? nic_compute_attributes.store(:ip, nic.ip) if (nic.ip && !nic.ip.empty?) nic_compute_attributes.store(:ip6, nic.ip6) if (nic.ip6 && !nic.ip6.empty?) hash.merge(index.to_s => nic_compute_attributes) -- 2.20.1
At least it works with VMs
I can also confirm that the workaround works.
Confirmed also. Would be nice to have v6 support ;)
On Mon, 19 Aug 2019 at 10:06, pdzionek notifications@github.com wrote:
I can also confirm that the workaround works.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/theforeman/foreman_fog_proxmox/issues/89?email_source=notifications&email_token=AI4SYBMENECY76AHE3QDBH3QFJPALA5CNFSM4H3V5242YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4SG5JA#issuecomment-522481316, or mute the thread https://github.com/notifications/unsubscribe-auth/AI4SYBOSYLGZ2ASSNW425RTQFJPALANCNFSM4H3V524Q .
The workaround does not work for LXC.
@jacac actually, i was able to provision some LXCs using this.
@tedkozma Thanks for the reply. Got it working by linking a smart proxy to the organization. Apparently you get the same error if the organization does not have any smart proxies associated. Just to clarify: I had to link smart proxy to the organization + comment those two lines + #86 to get it working.
@jacac one thing I don't understand is how to make those containers get puppet client set. Aside from trying to package another container template, which I also have little idea how to do.
Cloud-init is not supported on Proxmox for LXC. LXD added support through profiles (https://lxd.readthedocs.io/en/stable-3.0/cloud-init/ & https://blog.simos.info/how-to-preconfigure-lxd-containers-with-cloud-init/ ). I was playing with a default Centos template installing Cloud-Init manually and get it to run locally. Next step would be to have the configuration on the network and foreman pushing it. Not sure if I can get it to run though. We should create another issue and talk about integrating foreman+proxmox lxc+cloud-init.
@tristanrobert Thank you for fixing this. Would it be possible to reference your commits to the issue so that we can see how this issue is fixed and learn. I would like to contribute but don't know Ruby and seeing those commits really helps me to learn how this plugin works.
Describe the bug Create host does not work and the following error ist shown:
2019-06-26T10:39:53 [I|app|a134af24] Adding Compute instance for doyle-nicklos.proxmox.test 2019-06-26T10:39:53 [W|app|a134af24] Failed to create a compute Proxmox (Proxmox) instance doyle-nicklos.proxmox.test: private method `select' called for nil:NilClass
NoMethodError: private method
select' called for nil:NilClass /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb:148:in
block in host_interfaces_attrs' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb:136:ineach' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb:136:in
with_index' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb:136:ineach' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb:136:in
reduce' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb:136:inhost_interfaces_attrs' /usr/share/foreman/app/models/compute_resource.rb:143:in
host_compute_attrs' /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb:123:inhost_compute_attrs' /usr/share/foreman/app/models/concerns/orchestration/compute.rb:90:in
setCompute' /usr/share/foreman/app/models/concerns/orchestration.rb:222:inexecute' /usr/share/foreman/app/models/concerns/orchestration.rb:145:in
block in process' /usr/share/foreman/app/models/concerns/orchestration.rb:137:ineach' /usr/share/foreman/app/models/concerns/orchestration.rb:137:in
process' /usr/share/foreman/app/models/concerns/orchestration.rb:44:inaround_save_orchestration' /opt/theforeman/tfm-ror52/root/usr/share/gems/gems/activesupport-5.2.1/lib/active_support/callbacks.rb:118:in
block in run_callbacks' ...it seems, that in foreman_fog_proxmox-0.8.0/app/models/foreman_fog_proxmox/proxmox.rb:host_interfaces_attrs(host) the call to host.compute_attributes['interfaces_attributes'] returns nil.
To Reproduce create host