Skip to content

Commit cc22a39

Browse files
author
Gabriel Monroy
committed
use machineID where possible
1 parent 74f5229 commit cc22a39

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

updatectl/instance.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,15 @@ func randSleep(n, m int) {
292292
time.Sleep(time.Duration(r) * time.Second)
293293
}
294294

295+
// getClientID returns the CoreOS Machine ID or an unknown UUID string
296+
func getClientID() string {
297+
machineID := utils.GetMachineID("/")
298+
if machineID == "" {
299+
return fmt.Sprintf("{unknown-" + utils.NewUuid() + "}")
300+
}
301+
return machineID
302+
303+
}
295304
func instanceDeis(args []string, service *update.Service, out *tabwriter.Writer) int {
296305
if instanceFlags.appId == "" || instanceFlags.groupId == "" {
297306
return ERROR_USAGE
@@ -302,7 +311,7 @@ func instanceDeis(args []string, service *update.Service, out *tabwriter.Writer)
302311
}
303312

304313
c := &Client{
305-
Id: fmt.Sprintf("{update-client-" + utils.NewUuid()),
314+
Id: getClientID(),
306315
SessionId: uuid.New(),
307316
Version: instanceFlags.version,
308317
AppId: instanceFlags.appId,

0 commit comments

Comments
 (0)