~chipaca/ubuntu-push/whoopsie-whoopsie-whoopsie

« back to all changes in this revision

Viewing changes to client/client.go

  • Committer: Tarmac
  • Author(s): Diogo Baeder de Paula Pinto
  • Date: 2014-04-17 15:52:09 UTC
  • mfrom: (124.2.7 auth)
  • Revision ID: tarmac-20140417155209-yzxm94t4cur0aq2t
[r=chipaca] Moving the authorization retrieval to the client session start, so that it can be retried at a later time

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
        "launchpad.net/ubuntu-push/whoopsie/identifier"
44
44
)
45
45
 
46
 
var (
47
 
        getAuthorization = util.GetAuthorization
48
 
        shouldGetAuth    = false
49
 
)
50
 
 
51
46
// ClientConfig holds the client configuration
52
47
type ClientConfig struct {
53
48
        connectivity.ConnectivityConfig // q.v.
85
80
        actionsCh          <-chan notifications.RawActionReply
86
81
        session            *session.ClientSession
87
82
        sessionConnectedCh chan uint32
88
 
        auth               string
89
83
}
90
84
 
91
85
var ACTION_ID_SNOWFLAKE = "::ubuntu-push-client::"
120
114
        client.log = logger.NewSimpleLogger(os.Stderr, client.config.LogLevel.Level())
121
115
        qml.SetLogger(client.log)
122
116
 
123
 
        // grab the authorization string from the accounts
124
 
        // TODO: remove this condition when we have a way to deal with failing authorizations
125
 
        if shouldGetAuth {
126
 
                auth, err := getAuthorization()
127
 
                if err != nil {
128
 
                        return fmt.Errorf("unable to get the authorization token from the account: %v", err)
129
 
                }
130
 
                client.auth = auth
131
 
        }
132
 
 
133
117
        // overridden for testing
134
118
        client.idder = identifier.New()
135
119
        client.notificationsEndp = bus.SessionBus.Endpoint(notifications.BusAddress, client.log)
162
146
                ExchangeTimeout:        client.config.ExchangeTimeout.TimeDuration(),
163
147
                HostsCachingExpiryTime: client.config.HostsCachingExpiryTime.TimeDuration(),
164
148
                ExpectAllRepairedTime:  client.config.ExpectAllRepairedTime.TimeDuration(),
165
 
                PEM:           client.pem,
166
 
                Info:          info,
167
 
                Authorization: client.auth,
 
149
                PEM:  client.pem,
 
150
                Info: info,
168
151
        }
169
152
}
170
153