Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
kqdeng committed May 26, 2020
1 parent e12221f commit 66f0887
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion job/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,4 +208,4 @@ func (j Job) InitrdPath() string {
return (*j.hardware).InitrdPath(j.mac)
}
return ""
}
}
6 changes: 3 additions & 3 deletions job/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ func (j *Job) setup(dp *packet.Discovery) error {
return errors.New("could not find IP address")
}
j.dhcp.Setup(ip.Address, ip.Netmask, ip.Gateway)
j.dhcp.SetLeaseTime(d.LeaseTime(j.mac)) // cacher=env.DHCPLeaseTime
j.dhcp.SetDHCPServer(conf.PublicIPv4) // used for the unicast DHCPREQUEST
j.dhcp.SetDNSServers(d.DnsServers()) // cacher=env.DNSServers
j.dhcp.SetLeaseTime(d.LeaseTime(j.mac)) // cacher=env.DHCPLeaseTime
j.dhcp.SetDHCPServer(conf.PublicIPv4) // used for the unicast DHCPREQUEST
j.dhcp.SetDNSServers(d.DnsServers()) // cacher=env.DNSServers

hostname, err := d.Hostname()
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions packet/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ import (

cacherClient "github.com/packethost/cacher/client"
"github.com/packethost/cacher/protos/cacher"
tinkClient "github.com/tinkerbell/tink/client"
tink "github.com/tinkerbell/tink/protos/hardware"
"github.com/packethost/pkg/env"
"github.com/pkg/errors"
"github.com/tinkerbell/boots/httplog"
tinkClient "github.com/tinkerbell/tink/client"
tink "github.com/tinkerbell/tink/protos/hardware"
"google.golang.org/grpc"
)

Expand Down
5 changes: 3 additions & 2 deletions packet/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import (
"context"
"encoding/json"
"fmt"
tink "github.com/tinkerbell/tink/protos/hardware"
"github.com/packethost/cacher/protos/cacher"
"io"
"net"
"os"

"github.com/packethost/cacher/protos/cacher"
tink "github.com/tinkerbell/tink/protos/hardware"

"github.com/pkg/errors"
"github.com/prometheus/client_golang/prometheus"
"github.com/tinkerbell/boots/metrics"
Expand Down
18 changes: 9 additions & 9 deletions packet/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,9 @@ type HardwareCacher struct {

// HardwareTinkerbell represents the new hardware data model for tinkerbell
type HardwareTinkerbell struct {
ID string `json:"id"`
Network Network `json:"network"`
Metadata Metadata `json:"metadata"`
ID string `json:"id"`
Network Network `json:"network"`
Metadata Metadata `json:"metadata"`
}

// NewDiscovery instantiates a Discovery struct from the json argument
Expand Down Expand Up @@ -286,7 +286,7 @@ type NetworkInterface struct {
// DHCP holds details for DHCP connection
type DHCP struct {
MAC *MACAddr `json:"mac"`
IP IP `json:"ip"`
IP IP `json:"ip"`
Hostname string `json:"hostname"`
LeaseTime time.Duration `json:"lease_time"`
NameServers []string `json:"name_servers"`
Expand All @@ -298,7 +298,7 @@ type DHCP struct {

// Netboot holds details for a hardware to boot over network
type Netboot struct {
AllowPXE bool `json:"allow_pxe"` // to be removed?
AllowPXE bool `json:"allow_pxe"` // to be removed?
AllowWorkflow bool `json:"allow_workflow"` // to be removed?
IPXE struct {
URL string `json:"url"`
Expand All @@ -309,15 +309,15 @@ type Netboot struct {

// Bootstrapper is the bootstrapper to be used during netboot
type Osie struct {
BaseURL string `json:"base_url"`
Kernel string `json:"kernel"`
Initrd string `json:"initrd"`
BaseURL string `json:"base_url"`
Kernel string `json:"kernel"`
Initrd string `json:"initrd"`
}

// Network holds hardware network details
type Network struct {
Interfaces []NetworkInterface `json:"interfaces,omitempty"`
Default NetworkInterface `json:"default,omitempty"`
Default NetworkInterface `json:"default,omitempty"`
}

// Metadata holds the hardware metadata
Expand Down
2 changes: 1 addition & 1 deletion packet/models_cacher.go
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,4 @@ func (h HardwareCacher) KernelPath(mac net.HardwareAddr) string {
// dummy method for tink data model transition
func (h HardwareCacher) InitrdPath(mac net.HardwareAddr) string {
return ""
}
}
6 changes: 3 additions & 3 deletions packet/models_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ var tinkerbellTests = map[string]struct {
json string
}{
"new_structure": {
id: "fde7c87c-d154-447e-9fce-7eb7bdec90c0",
mac: "ec:0d:9a:c0:01:0c",
ip: IP{
id: "fde7c87c-d154-447e-9fce-7eb7bdec90c0",
mac: "ec:0d:9a:c0:01:0c",
ip: IP{
Address: net.ParseIP("192.168.1.5"),
Netmask: net.ParseIP("255.255.255.248"),
Gateway: net.ParseIP("192.168.1.1"),
Expand Down
2 changes: 1 addition & 1 deletion packet/models_tinkerbell.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,4 +156,4 @@ func (h HardwareTinkerbell) KernelPath(mac net.HardwareAddr) string {

func (h HardwareTinkerbell) InitrdPath(mac net.HardwareAddr) string {
return h.Network.InterfaceByMac(mac).Netboot.Osie.Initrd
}
}

0 comments on commit 66f0887

Please sign in to comment.