~fgimenez/charms/trusty/kubernetes/allow-privileged

« back to all changes in this revision

Viewing changes to hooks/lib/registrator.py

  • Committer: Charles Butler
  • Date: 2015-09-30 21:41:25 UTC
  • Revision ID: chuck@dasroot.net-20150930214125-57w1ju09long2u07
Re-introduce handling for a 409 response code when the k8's node has registered
with ETCD already. This happens during the etcd-relation-changed sequence often
and is not an error case, So halting the unit execution is not desireable.

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
 
62
62
    def command_succeeded(self, response, result):
63
63
        ''' Evaluate response data to determine if the command successful '''
64
 
        if response.status in [200, 201]:
 
64
        if response.status in [200, 201, 409]:
 
65
            # The 409 response is when a unit is already registered. We do not
 
66
            # have an update method above, so for now, accept whats in etcd and
 
67
            # assume registered.
65
68
            print("Registered")
66
69
            return True
67
70
        elif response.status in (500,) and result.get(