Backend: initialized vs uninitialized state

After you initialize a backend, what changes? Is there a new file that is created somewhere?

I’m writing an Ansible role to configure Sensu, and there’s no point to even try to run the initialization step again if the backend is already initialized. I know the initialization itself is idempotent, but it’s faster if Ansible could figure out that a file was created somewhere and then it doesn’t need to do that again.

Hey,

There is no file but there is a key “”.initialized"" in the etcd store set to “1” to indicate the sensu-backend has been initialized. This is what the init function checks when it operates to avoide re-init. I’m not sure if the key name is meant to be reliable or if it should be considered an implementation detail.
The init function really is only manipulating the etcd store, which might be an external service so there’s no way to leave any filesystem breadcumbs, you have to look into the etcd store somehow.

Choices:

  • Just run init multiple times and let it check the etcd store for the initialized key
  • Check etcd store yourself to make sure the initialized key exists…
  • Try to auth using the sensu-backend auth endpoint and see you can auth with the admin creds you were trying to inject with the init.
1 Like