Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit bbbd17e

Browse files
committed
api: s/machine/machineID/
1 parent ba90edb commit bbbd17e

10 files changed

Lines changed: 15 additions & 15 deletions

File tree

Documentation/api-v1-alpha.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ Content-Length: 80
8282
- **options**: list of UnitOption entities
8383
- **desiredState**: state the user wishes the Unit to be in ("inactive", "loaded", or "launched")
8484
- **currentState**: (readonly) state the Unit is currently in (same possible values as desiredState)
85-
- **machine**: ID of machine to which the Unit is scheduled
85+
- **machineID**: ID of machine to which the Unit is scheduled
8686

8787
A UnitOption represents a single option in a systemd unit file.
8888

fleetctl/fleetctl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,11 +623,11 @@ func assertUnitState(name string, js job.JobState, out io.Writer) (ret bool) {
623623
ret = true
624624
msg := fmt.Sprintf("Unit %s %s", name, u.CurrentState)
625625

626-
if u.Machine == "" {
626+
if u.MachineID == "" {
627627
return
628628
}
629629

630-
ms := cachedMachineState(u.Machine)
630+
ms := cachedMachineState(u.MachineID)
631631
if ms != nil {
632632
msg = fmt.Sprintf("%s on %s", msg, machineFullLegend(*ms, false))
633633
}

fleetctl/journal.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,5 @@ func runJournal(args []string) (exit int) {
5656
command += " -f"
5757
}
5858

59-
return runCommand(command, u.Machine)
59+
return runCommand(command, u.MachineID)
6060
}

fleetctl/list_unit_files.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ var (
3434
return u.DesiredState
3535
},
3636
"tmachine": func(u schema.Unit, full bool) string {
37-
if u.Machine == "" {
37+
if u.MachineID == "" {
3838
return "-"
3939
}
40-
ms := cachedMachineState(u.Machine)
40+
ms := cachedMachineState(u.MachineID)
4141
if ms == nil {
42-
ms = &machine.MachineState{ID: u.Machine}
42+
ms = &machine.MachineState{ID: u.MachineID}
4343
}
4444

4545
return machineFullLegend(*ms, full)

fleetctl/list_unit_files_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ func TestListUnitFilesFieldsToStrings(t *testing.T) {
4747
// machineStates must be initialized since cAPI is not set
4848
machineStates = map[string]*machine.MachineState{}
4949

50-
u.Machine = "some-id"
50+
u.MachineID = "some-id"
5151
ms := listUnitFilesFields["tmachine"](u, true)
5252
assertEqual(t, "machine", "some-id", ms)
5353

54-
u.Machine = "other-id"
54+
u.MachineID = "other-id"
5555
machineStates = map[string]*machine.MachineState{
5656
"other-id": &machine.MachineState{
5757
ID: "other-id",

fleetctl/ssh.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ func findAddressInRunningUnits(name string) (string, bool) {
171171
if u == nil {
172172
return "", false
173173
}
174-
m := cachedMachineState(u.Machine)
174+
m := cachedMachineState(u.MachineID)
175175
if m != nil && m.PublicIP != "" {
176176
return m.PublicIP, true
177177
}

fleetctl/status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,5 @@ func printUnitStatus(name string) int {
5454
}
5555

5656
cmd := fmt.Sprintf("systemctl status -l %s", name)
57-
return runCommand(cmd, u.Machine)
57+
return runCommand(cmd, u.MachineID)
5858
}

schema/mapper.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func MapUnitToSchemaUnit(u *job.Unit, su *job.ScheduledUnit) *Unit {
5050
}
5151

5252
if su != nil {
53-
s.Machine = su.TargetMachineID
53+
s.MachineID = su.TargetMachineID
5454
if su.State != nil {
5555
s.CurrentState = string(*su.State)
5656
}
@@ -147,7 +147,7 @@ func MapSchemaUnitToScheduledUnit(entity *Unit) *job.ScheduledUnit {
147147
return &job.ScheduledUnit{
148148
Name: entity.Name,
149149
State: &cs,
150-
TargetMachineID: entity.Machine,
150+
TargetMachineID: entity.MachineID,
151151
}
152152
}
153153

schema/v1-alpha-gen.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ type Unit struct {
108108

109109
DesiredState string `json:"desiredState,omitempty"`
110110

111-
Machine string `json:"machine,omitempty"`
111+
MachineID string `json:"machineID,omitempty"`
112112

113113
Name string `json:"name,omitempty"`
114114

schema/v1-alpha.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
"launched"
109109
]
110110
},
111-
"machine": {
111+
"machineID": {
112112
"type": "string",
113113
"required": true
114114
}

0 commit comments

Comments
 (0)