Git Product home page Git Product logo

govsphere's People

Contributors

c4milo avatar ddelazerda avatar gitter-badger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

govsphere's Issues

Panic when calling ServiceInstance.Content().RootFolder.ChildEntity()

Here is a gist with the log from the panic.
I ran the code with GDB and this was the output.
Here is the code:

package main

import (
  "fmt"
  vim "govsphere/vim"
)

func main () {

   session := vim.NewVSphereSession("https://myhost.com/sdk", "myuser", "mypassword", true)

   content, err := session.ServiceInstance.Content()

   if err != nil {
     panic("unable to get the service content")
   }

   childs, err := content.RootFolder.ChildEntity() // <------- THIS CALL WILL PANIC

   if err != nil {
     panic("unable to get the child entities from the RootFolder")
   }

   for child := range childs {
     fmt.Println("child: %v", child)
   }

   err = session.ServiceContent.SessionManager.Logout()
   if err != nil {
     panic("unable to logout from the vsphere server")
   }

   fmt.Println("Done!")
}

Panic when calling VmFolder().ChildEntity()

Here is the panic log.

Here is the code to reproduce it:

package main

import (
  "fmt"
  vim "govsphere/vim"
)

func main() {

  session := vim.NewVSphereSession("https://myhost.com/sdk", "myuser", "mypass", true)

  content, err := session.ServiceInstance.Content()

  if err != nil {
    fmt.Printf("--> Encountered an error getting content from ServiceInstance: %#v <--\n", err)
    panic(err)
  }

  children, err := content.RootFolder.ChildEntity()

  if err != nil {
    fmt.Printf("--> Encountered an error getting childEntity from vmFolder: %#v <--\n", err)
    panic(err)
  }

  for _, child := range children {

    if child.Type == "Datacenter" {

      datacenter := &vim.Datacenter{
        ManagedEntity: child,
      }

      vmfolder, err := datacenter.VmFolder()
      if err != nil {
        fmt.Printf("--> Encountered an error getting vmFolder from datacenter: %#v <--\n", err)
        panic(err)
      }

      vms, err := vmfolder.ChildEntity() // <--- THIS WILL PANIC

      if err != nil {
        fmt.Printf("--> Encountered an error getting childEntity from vmFolder: %#v <--\n", err)
      } else {
        fmt.Printf("VMs --> %#v\n", vms)
      }

    }
  }

  err = session.ServiceContent.SessionManager.Logout()

  if err != nil {
    fmt.Printf("--> Unable to logout! Error: %#v <--\n", err)
    panic(err)
  }

  fmt.Println("Done!")
}

Let me know if you need more information.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.