Fix return value; Remove short flags to avoid collisions; Update documentation
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Danny Bessems 2023-01-18 12:16:51 +01:00
parent a38b097309
commit 5c12ec5b93
4 changed files with 12 additions and 9 deletions

View File

@ -3,7 +3,7 @@ type: kubernetes
name: 'Golang Build'
environment:
BINARY_VERSION: v0.4.5
BINARY_VERSION: v0.5.0
clone:
disable: true

View File

@ -1,10 +1,13 @@
# NPP-Prepper
# NPP-Prepper [![Build Status](https://ci.spamasaurus.com/api/badges/djpbessems/Go.NPP-Prepper/status.svg)](https://ci.spamasaurus.com/djpbessems/Go.NPP-Prepper)
A simple static binary that allows the creation of vCenter's Network Protocol Profiles (within vCenter's API referred to as IpPools).
Existing tooling like `govc` or `PowerCLI` can either not be used to configure IpPools, or adds unreasonably large overhead (container image `vmware/powerclicore` is nearly 1GB large). In fact, VMware's documentation *only* mentions how to use this feature through the use of vCenter's webinterface, which is entirely pointless in nowadays' world of automation.
`npp-prepper` was born out of necessity; one of my projects involves bootstrapping OVA's in greenfield environments, with the explicit design choice to not rely on external processes, like DHCP.
### Download
Latest release can be downloaded [here](https://code.spamasaurus.com/djpbessems/-/packages/generic/npp-prepper)
### Usage
```bash
Usage:
@ -42,7 +45,7 @@ Help Options:
[dc command options]
-n, --name= Name of datacenter
-p, --portgroup= Name of network portgroup
--portgroup= Name of network portgroup
--startaddress=
--endaddress=
--netmask=
@ -69,9 +72,9 @@ Help Options:
-h, --help Show this help message
[vm command options]
-d, --datacenter= Name of datacenter
-n, --name= Name of virtual machine
-p, --portgroup= Name of network portgroup
--datacenter= Name of datacenter
--portgroup= Name of network portgroup
```
### Future plans

View File

@ -18,7 +18,7 @@ var Global struct {
var Commands struct {
Datacenter struct {
Name string `short:"n" long:"name" description:"Name of datacenter" required:"true"`
Network string `short:"p" long:"portgroup" description:"Name of network portgroup" required:"true"`
Network string `long:"portgroup" description:"Name of network portgroup" required:"true"`
StartAddress string `long:"startaddress" required:"true"`
EndAddress string `long:"endaddress" required:"true"`
Netmask string `long:"netmask" required:"true"`
@ -28,9 +28,9 @@ var Commands struct {
Force bool `short:"f" long:"force"`
} // `command:"datacenter" alias:"dc" description:"Define a Network Protocol Profile within a datacenter"`
VirtualMachine struct {
Datacenter string `short:"d" long:"datacenter" description:"Name of datacenter" required:"true"`
Name string `short:"n" long:"name" description:"Name of virtual machine" required:"true"`
Network string `short:"p" long:"portgroup" description:"Name of network portgroup" required:"true"`
Datacenter string `long:"datacenter" description:"Name of datacenter" required:"true"`
Network string `long:"portgroup" description:"Name of network portgroup" required:"true"`
} // `command:"virtualmachine" alias:"vm" description:"Configure a virtual machine for usage of Network Protocol Profiles"`
GuestOS struct {
} // `command:"guestos" alias:"os" description:"Configure guest OS network with allocated IP address"`

View File

@ -29,7 +29,7 @@ func NewClient(ctx context.Context, host, username, password string, insecure bo
return nil, err
}
return clt, err
return clt, nil
}
func DatacenterFinder(ctx context.Context, clt *vim25.Client, datacenter string) (*find.Finder, error) {