Skip to content

Unable to fetch VirtualMachine.Primary_IP.address #36

Description

@valentin2105

Hello,

I'm building an RoR app that fetch my Netbox instance to show our virtual machines.

I'm happy to find your lib, it work as well but I got issues to fetch a variable.

Maybe it's my low level in Ruby the cause, but I don't find any answer.

# I fetch VMs in my Controller
      vms = NetboxClientRuby.virtualization.virtual_machines.filter(cluster_id: cluster_id)

# I use the @vms var in my ERB html files

 <% @vms.each do |vm| %>
        <tr>
# This Work well
            <td><%= vm.name %></td>
            <td><%= vm.vcpus %></td>
            <td><%= vm.memory %>Mo</td>
            <td><%= vm.disk %>Go</td>
# This doesn't work
            <td> <%= vm.primary_ip.name %></td>   
        </tr>
<% end %>
                

I have tried vm.primary_ip['address'], vm.primary_ip('address') and few other way, but I'm unable to get my VM Primary IP Address.

I got error like this :

undefined method name' for #NetboxClientRuby::IPAM::IpAddress:0x00007ffff51d63c8`

Any idea ?

Thanks by advance

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions