Skip to content

Unable to fetch VirtualMachine.Primary_IP.address #36

Closed as not planned
Closed as not planned

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

  1. thde commented on Feb 12, 2021

    @thde
    Member

    vm.primary_ip.address?

  2. thde commented on Jul 22, 2022

    @thde
    Member

    Closing this issue for now. Feel free to open it again if the issue persists.

  3. locked and limited conversation to collaborators on May 26, 2025
  4. converted this issue into a discussion #106 on May 26, 2025
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