Simple relations for simple people

Myself and @timClicks were discussing various aspects of Juju on the IRC channel tonight and I had a bit of a thought/question about relations that I’d like to run past people who know better than me…

90% of all the few relations I’ve ever written involve taking an interface on side a and passing it to b and an interface on side b and passing it to a.

So, I could define that in YAML, for example a JDBC interface:

App end would be:

fields:
     service_name

and database side would be:

fields:
    username
    password
    database
    ip_address

Instead of relation styling that changes all the time and does crazy things most of which the majority of us don’t know (see here) why can’t we have a simple

charm interface build

that takes our metadata YAML code and builds it out into something that knows how to pass the data from a to b? Which is 90% of the time, all we developers want it to do.

3 Likes

All thoughts on lowering entry-point to advanced development of juju charms are good for the juju community.

+1+1+1

2 Likes

Thanks @erik-lonroth

The other thing about a compiled, yaml driven interface is that for a moron like me, it becomes pretty much self documenting… which, when you’re trying to figure out what’s going through an interface and what that object might look like without trying to debug a running charm, it would be an absolute godsend.

2 Likes

Hey @magicaltrout, I’m working on the Lucky charming framework which is work-in-progress and not ready-to-use yet, but I’m intrigued by your idea for the charm interfaces.

So, if you define your charm interfaces in a YAML like you say, how are you imagining that you interact with that interface in charm code?

Would those charm definitions just become Python objects with the fields that existed in your YAML? In the end interfaces really are just keys and values on each-side, so would you even need a YAML definition if in code you were just doing something like:

# On the app side
interface.local.set("service_name", "myservice")
let db_username = interface.remote.get("username")
let db_password = interface.remote.get("password")

You might still want some form of definition, like YAML, for the interfaces for documentation purposes, but if there was an easy way to set/get key values on the interface would that be enough?