~ps-jenkins/ubuntu-push/ubuntu-vivid-proposed

« back to all changes in this revision

Viewing changes to client/client.go

  • Committer: Guillermo Gonzalez
  • Date: 2014-08-04 20:40:50 UTC
  • mto: (91.148.26 automatic)
  • mto: This revision was merged to the branch mainline in revision 119.
  • Revision ID: guillermo.gonzalez@canonical.com-20140804204050-0tbj2xmmy6cs9a6u
replace whoopsie with /var/lib/dbus/machine-id

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
        "launchpad.net/ubuntu-push/client/session"
42
42
        "launchpad.net/ubuntu-push/client/session/seenstate"
43
43
        "launchpad.net/ubuntu-push/config"
 
44
        "launchpad.net/ubuntu-push/identifier"
44
45
        "launchpad.net/ubuntu-push/logger"
45
46
        "launchpad.net/ubuntu-push/protocol"
46
47
        "launchpad.net/ubuntu-push/util"
47
 
        "launchpad.net/ubuntu-push/whoopsie/identifier"
48
48
)
49
49
 
50
50
// ClientConfig holds the client configuration
152
152
        client.unregisterCh = make(chan *click.AppId, 10)
153
153
 
154
154
        // overridden for testing
155
 
        client.idder = identifier.New()
 
155
        client.idder, err = identifier.New()
 
156
        if err != nil {
 
157
                return err
 
158
        }
156
159
        client.connectivityEndp = bus.SystemBus.Endpoint(networkmanager.BusAddress, client.log)
157
160
        client.systemImageEndp = bus.SystemBus.Endpoint(systemimage.BusAddress, client.log)
158
161
 
222
225
        }
223
226
}
224
227
 
225
 
// getDeviceId gets the whoopsie identifier for the device
 
228
// getDeviceId gets the identifier for the device
226
229
func (client *PushClient) getDeviceId() error {
227
 
        err := client.idder.Generate()
228
 
        if err != nil {
229
 
                return err
230
 
        }
231
230
        baseId := client.idder.String()
232
231
        b, err := hex.DecodeString(baseId)
233
232
        if err != nil {
234
 
                return fmt.Errorf("whoopsie id should be hex: %v", err)
 
233
                return fmt.Errorf("machine-id should be hex: %v", err)
235
234
        }
236
235
        h := sha256.Sum224(b)
237
236
        client.deviceId = base64.StdEncoding.EncodeToString(h[:])