On 23 February 2017 at 15:46, Stuart Bishop <stuart.bis...@canonical.com> wrote:
> On 23 February 2017 at 01:46, James Beedy <jamesbe...@gmail.com> wrote:
>
>>> I think I can fix this, but I'll need to make a corresponding
>>> adjustment in the PostgreSQL charm and the fix will only take effect
>>> with updated services.
>>>
>> +1 for a fix. Thanks.
>
>>> Its related to the above issue. Your charm connects and gets the
>>> db.master.available state set. But you want to specify the database
>>> name, so a handler runs calling set_database(). At this point the
>>> .master and .standbys properties start correctly returning None, but
>>> set_database() neglected to remove the *.available states so handlers
>>> got kicked in that shouldn't have.
>>>
>> Ok, so a fix coming for this too in that case? This one is borking on my
>> devs who are deploying my bundles, in turn causing me grief, but also
>> borking on me too, making me question my own sanity :(
>
> Yes. I'll push a fix out shortly.

I've pushed a fix for your second issue (the 'available' states not
being removed when you change the requested database name).

I won't be able to fix the first issue today. For now, I think you can
work around it using an extra state.

@when('db.connected')
@when_not('dbname.requested')
def request_database_name(psql):
    psql.set_database('foobar')
    reactive.set_state('dbname.requested')

@when_all('db.master.available', 'dbname.requested')
def do_stuff_needing_master_db(psql):
    assert psql.master is not None
    assert psql.master.dbname == 'foobar'


-- 
Stuart Bishop <stuart.bis...@canonical.com>

-- 
Juju mailing list
Juju@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/juju

Reply via email to