That is already done by the mkdir imported from charmhelpers.core.host. — Beppe
> On 07 nov 2017, at 13:06, John Meinel <[email protected]> wrote: > > It seems like you would tend to use: > import os > > os.makedirs(os.path.dirname(config_file)) > > Which doesn't treat a directory that already exists as a failure. > However, I'm guessing that there is some other expectation that the directory > should be created at some other time. > > John > =:-> > > > On Tue, Nov 7, 2017 at 3:57 PM, Giuseppe Attardi <[email protected] > <mailto:[email protected]>> wrote: > I run into a problem when adding a unit to keystone. > > The log shows this; > > 2017-11-07 11:18:11 DEBUG leader-settings-changed File > "/var/lib/juju/agents/unit-keystone-ba1-cl2-14/charm/hooks/leader-settings-changed", > line 675, in leader_settings_changed > 2017-11-07 11:18:11 DEBUG leader-settings-changed > update_all_identity_relation_units() > 2017-11-07 11:18:11 DEBUG leader-settings-changed File > "/var/lib/juju/agents/unit-keystone-ba1-cl2-14/charm/hooks/leader-settings-changed", > line 353, in update_all_identity_relation_units > 2017-11-07 11:18:11 DEBUG leader-settings-changed CONFIGS.write_all() > 2017-11-07 11:18:11 DEBUG leader-settings-changed File > "/var/lib/juju/agents/unit-keystone-ba1-cl2-14/charm/hooks/charmhelpers/contrib/openstack/templating.py", > line 285, in write_all > 2017-11-07 11:18:11 DEBUG leader-settings-changed [self.write(k) for k in > six.iterkeys(self.templates)] > 2017-11-07 11:18:11 DEBUG leader-settings-changed File > "/var/lib/juju/agents/unit-keystone-ba1-cl2-14/charm/hooks/charmhelpers/contrib/openstack/templating.py", > line 276, in write > 2017-11-07 11:18:11 DEBUG leader-settings-changed with open(config_file, > 'wb') as out: > 2017-11-07 11:18:11 DEBUG leader-settings-changed IOError: [Errno 2] No such > file or directory: '/etc/keystone/keystone.conf' > 2017-11-07 11:18:11 ERROR juju.worker.uniter.operation runhook.go:107 hook > "leader-settings-changed" failed: exit status 1 > > and indeed the directory /etc/keystone is still missing. > I am using Juju 2.2.4 and a variant of the keystone charm from stable/17.08. > > I solved the problem by adding: > > from charmhelpers.core.host import (mkdir) # Attardi > mkdir(os.path.dirname(config_file)) # Attardi > > in templating.py before line 276. > Doing so should be no harm, but I wonder whether this is the right solution. > > — Beppe > > > -- > Juju mailing list > [email protected] <mailto:[email protected]> > Modify settings or unsubscribe at: > https://lists.ubuntu.com/mailman/listinfo/juju > <https://lists.ubuntu.com/mailman/listinfo/juju> >
-- Juju mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju
