func createRenderOpts(c *cli.Context, config *configuration.InductorConfiguration) (*renderer.RenderOptions, error) { var osname string if len(c.Args()) > 0 { osname = c.Args()[0] } else { fmt.Println("Available Operating Systems:") fmt.Println() for _, s := range config.List() { fmt.Println(fmt.Sprintf(" %s", s)) } fmt.Println() return nil, errors.New("You must specify an operating system argument") } // create the default options set based on the inductor config var edition string if len(c.String("edition")) > 0 { edition = c.String("edition") } opts, err := renderer.NewRenderOptions(osname, edition, config) // apply any command line overrides to the options set opts.WindowsUpdates = !c.Bool("skipwindowsupdates") opts.Headless = !c.Bool("gui") if len(c.String("productkey")) > 0 { opts.ProductKey = c.String("productkey") } if c.Bool("ssh") { opts.Communicator = "ssh" } return opts, err }
It("should a password of secret", func() { Expect(config.Password).To(Equal("secret")) }) It("should have RAM set to 1024", func() { Expect(config.RAM).To(Equal(uint32(1024))) }) It("should have 2 CPUs", func() { Expect(config.CPU).To(Equal(uint8(1))) }) It("should have a disk size of 10000", func() { Expect(config.DiskSize).To(Equal(uint32(10000))) }) Describe("List available operating systems", func() { var oses []string BeforeEach(func() { oses = config.List() }) It("should return 2 operating systems", func() { Expect(oses).To(HaveLen(2)) }) It("should return windows10 as the first entry", func() { Expect(oses[0]).To(Equal("windows10")) }) It("should return windows2008r2 as the second entry", func() { Expect(oses[1]).To(Equal("windows2008r2")) }) }) Describe("Get operating system configuration", func() { var ( os *configuration.OperatingSystem found bool