diff --git a/entrypoint/src/bootstrap/garage.go b/entrypoint/src/bootstrap/garage.go index 21d194e..2711ba0 100644 --- a/entrypoint/src/bootstrap/garage.go +++ b/entrypoint/src/bootstrap/garage.go @@ -36,7 +36,8 @@ func (b Bootstrap) GaragePeers() []garage.RemotePeer { func (b Bootstrap) GarageRPCPeerAddrs() []string { var addrs []string for _, peer := range b.GaragePeers() { - addrs = append(addrs, peer.RPCPeerAddr()) + addr := peer.RPCPeerAddr() + addrs = append(addrs, addr) } return addrs } diff --git a/entrypoint/src/cmd/entrypoint/admin.go b/entrypoint/src/cmd/entrypoint/admin.go index c844ed6..97b8c2d 100644 --- a/entrypoint/src/cmd/entrypoint/admin.go +++ b/entrypoint/src/cmd/entrypoint/admin.go @@ -69,14 +69,14 @@ var subCmdAdminCreateNetwork = subCmd{ "Domain name that should be used as the root domain in the network.", ) - subnetStr := flags.StringP( - "subnet", "s", "", - "CIDR which denotes the subnet that IPs hosts on the network can be assigned.", + ipNetStr := flags.StringP( + "ip-net", "i", "", + `IP+prefix (e.g. "10.10.0.1/16") which denotes the IP of this host, which will be the first host in the network, and the range of IPs which other hosts in the network can be assigned`, ) hostName := flags.StringP( "name", "n", "", - "Name of the host which will be the first host in the network", + "Name of this host, which will be the first host in the network", ) if err := flags.Parse(subCmdCtx.args); err != nil { @@ -87,15 +87,15 @@ var subCmdAdminCreateNetwork = subCmd{ return daemon.CopyDefaultConfig(os.Stdout, envAppDirPath) } - if *domain == "" || *subnetStr == "" || *hostName == "" { - return errors.New("--domain, --subnet, and --name are required") + if *domain == "" || *ipNetStr == "" || *hostName == "" { + return errors.New("--domain, --ip-net, and --name are required") } *domain = strings.TrimRight(strings.TrimLeft(*domain, "."), ".") - ip, subnet, err := net.ParseCIDR(*subnetStr) + ip, subnet, err := net.ParseCIDR(*ipNetStr) if err != nil { - return fmt.Errorf("parsing %q as a CIDR: %w", *subnetStr, err) + return fmt.Errorf("parsing %q as a CIDR: %w", *ipNetStr, err) } if err := validateHostName(*hostName); err != nil { diff --git a/entrypoint/src/garage/garage.go b/entrypoint/src/garage/garage.go index 0eb0146..e9752a6 100644 --- a/entrypoint/src/garage/garage.go +++ b/entrypoint/src/garage/garage.go @@ -59,6 +59,7 @@ func InitAlloc(metaDirPath string) (string, error) { return false } else if _, err = os.Stat(path); errors.Is(err, fs.ErrNotExist) { + err = nil return false } else if err != nil { @@ -100,5 +101,5 @@ func InitAlloc(metaDirPath string) (string, error) { return "", fmt.Errorf("writing public key to %q: %w", nodeKeyPubPath, err) } - return "", nil + return hex.EncodeToString(pubKey), nil }