Getting access to config in actions

Tom Barber tom at spicule.co.uk
Thu Dec 29 16:54:01 UTC 2016


Not sure if I'm doing something stupid here or not.

If I do something like:


  config = hookenv.config()
  config['the-crawldb-uri'] = 'test'# s.connection_string()
  print("set value is" +config['the-crawldb-uri'])

in a reactive python charm, I want to be able to access that value in an
action which I seem to fail miserably on, anything config related like:

juju run --unit sparkler/0 "config-get the-crawldb-uri"
or

from charmhelpers.core import hookenv

def main():
    out = hookenv.config('the-crawldb-uri')
    print("uri is "+out)

just returns null. But if I manually set a value in a config block and call
config-get it returns the value, so how do I bridge that gap?




-- 
Tom Barber
CTO Spicule LTD
tom at spicule.co.uk

http://spicule.co.uk

@spiculeim <http://twitter.com/spiculeim>

Schedule a meeting with me <http://meetme.so/spicule>

GB: +44(0)5603641316
US: +18448141689
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/juju/attachments/20161229/944a90a2/attachment.html>


More information about the Juju mailing list