autoreg cronjob fails because can't found controllers.yaml in root dir

Bug #1865148 reported by Giuseppe Petralia
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
charm-autoreg
Invalid
Undecided
Unassigned

Bug Description

This is happening both in bionic and xenial.

When I run the cronjob generated like this:
19,49 * * * * root autoreg.sync-juju-users --model-access admin --controller-access superuser --groups bootstack-squad; autoreg.collect-user-keys --groups bootstack-squad --targetdir /var/lib/charm-autoreg/sshkeys

the autoreg.sync-juju-users fails because "/root/.local/share/juju/controllers.yaml" can not be found.

my controllers.yaml is in /home/ubuntu/.local/share/juju/controllers.yaml

and

$ juju config autoreg-xenial bootstrap-user
ubuntu

If I am not missing something, I expect the charm should look for controllers.yaml under the ubuntu home directory.

To workaround this I copied /home/ubuntu/.local/share/juju/ to /root/.local/share/juju/ and it worked

Revision history for this message
Paul Goins (vultaire) wrote :

To make that work by hand, you need to export the two environment variables directly above the command line in the cron job. Specifically, this is what you would run as root:

export JUJU_DATA=/home/ubuntu/.local/share/juju
export PATH=/usr/local/bin:/bin:/usr/bin:/snap/bin:/sbin:/usr/sbin:/usr/local/sbin
autoreg.sync-juju-users --model-access admin --controller-access superuser --groups warthogs; autoreg.collect-user-keys --groups warthogs --targetdir /var/lib/charm-autoreg/sshkeys

I've tested the above and it does work. Thus, I think this bug is invalid.

Changed in charm-juju-autoreg:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.