/srv/irclogs.ubuntu.com/2018/06/04/#juju.txt

myratwassup guys07:01
TheAbsentOneHey everyone, I need some help from a pro charmer. I have a charm (A) that uses the pgsql interface to communicate with the postgres charm (P). I know want A to be able to change the postgres pg_hba.conf (I want to add an entry). What is the best way to do this? No postgres library allows me to edit this file it seems :/ Is it possible for a charm to change a file on a remote charm?09:43
TheAbsentOneI should probably ping stub for that question. Is it possible for another charm (so not the postgresql) to edit the pg_hba.conf? So no manual (ssh) steps are needed?11:32
=== TAO is now known as Guest13252
=== Guest85905 is now known as zeus
=== beisner is now known as beisner-sick
stubTheAbsentOne: No. If a subordinate charm did make a change, the main PostgreSQL charm would stomp on it. There is the extra_pg_auth  charm config option, but charms can't set their own or other's charm config.13:29
stubI think you will need to connect your charms to pgbouncer rather than directly to PostgreSQL. pgbouncer doesn't do IP address checks, so if a charm leaks credentials to another charm, the other charm will also be able to connect via pgbouncer using them.13:33
TheAbsentOnestub: and is there a way (without looking at postgres) for a charm to edit a config file remotely? That would solve it too. I'm not sure how pgbouncer works, I'll look into it later todat14:49
gnuoycory_fu, I think https://bugs.launchpad.net/juju/+bug/1738614/comments/10 is the issue with libjuju ci15:12
mupBug #1738614: LXD pool already exists <lxd-provider> <storage> <juju:Incomplete by ecjones> <https://launchpad.net/bugs/1738614>15:12
TheAbsentOnestub: could you also tell me how it actually works. I connect to pgbouncer as if it was postgresql charm through the pgsql interface; I use set_database to request a database and then what? What happens in terms of auhentication? What does the pgbouncer and the postgres charms actually do?15:42
stubTheAbsentOne: A subordinate charm is cohosted, so can edit all local config files. Charms need to cooperate to do this though, or they will stomp on each other. A remote charm cannot edit anything on a unit it is related to - that would be a security hole. The remote charm can only ask on the relation for some operation to occur, which requires a protocol that supports it.15:42
stubTheAbsentOne: The pgbouncer charm is a proxy, and to your clients just looks like PostgreSQL. It talks the same protocol to the clients.15:43
stubTheAbsentOne: The difference is that pgbouncer does not support IP address restrictions.15:43
TheAbsentOnestub: So that means that the postgres user, that is created when the set_database request occurs, can access the database from whatever host then?15:45
stubTheAbsentOne: So if your unit is related to PostgreSQL, only your unit (and subordinates) can use the credentials it hands out. But if your unit is related to pgbouncer, any unit can use the credentials it hands out.15:45
stubyes15:45
stubA security limitation, but a helpful one in your case.15:46
TheAbsentOneAh I see, I'm gonna test it out, a huge thanks stub! And maybe (it's a very small maybe) I will pull your repo and try to implement the feature request but I doubt I will succeed :P15:46
TheAbsentOnecorrect it's not the optimal solution, the feature request on the interface would be the perfect scenario!15:46
TheAbsentOnethanks again sir stub!15:47
stubSure. I've been buried in Cassandra, and won't be back on PostgreSQL for a bit (I've got automatic failover half done, so that is up next)15:47
stubThere is now a published Cassandra interface, if it was you who was asking the other week.15:48
TheAbsentOneohn would you mind sharing your cassandra repo? Or is it not online yet? You created an interface?15:48
TheAbsentOneyeah x)15:48
stubinterace:cassandra now works in your layer.yaml, per https://github.com/stub42/interface-cassandra15:49
TheAbsentOneI might try to add cassandra support to my charm then as well, good stuff15:49
stubhttps://git.launchpad.net/cqlsh-charm/tree/ is a simple charm that uses it15:49
stub(cs:~cassandra-charmers/cqlsh )15:50
TheAbsentOneawesome I look into it after I fix postgres and mysql!15:50
=== dannf` is now known as dannf
cory_fujamespage: You around?  I've been requested to facilitate a charm-helpers release for the goal_state helper.16:17
TheAbsentOneI want to install this on a charm: https://github.com/PyMySQL/PyMySQL, since it's installable through pip I thought adding a wheelhouse.txt with the name (pymysql) was enough. What am I forgetting? :/17:19
kwmonroeTheAbsentOne: that should be it.  charm build after you update the wheelhouse.txt should stick that in the output ./wheelhouse directory, which gets installed at charm deploy time.18:07
TheAbsentOnekwmonroe: it seems no archive was created in the wheelhouse dir any idea how I can solve this?18:37
TheAbsentOnekwmonroe: nvm I have no explenation but I redid a build and it is fine, I think I didn't put the wheelhouse.txt where it belonged or something18:40
TheAbsentOnethanks man!18:40
kwmonroenp, glad it's there now18:42
TheAbsentOnekwmonroe: what was the best/easiest way to fetch the IP app of the charm where I (another charm) has a relation with?19:15
kwmonroeTheAbsentOne: if you're dealing with a python charm that includes charmhelpers, use the hookenv network_get: https://github.com/juju/charm-helpers/blob/master/charmhelpers/core/hookenv.py#L115719:25
kwmonroeTheAbsentOne: here's a sample: https://git.launchpad.net/postgresql-charm/tree/reactive/postgresql/client.py#n35019:27
Guest25856hi20:10
TheAbsentOneperfect kwmonroe gonna try now, thanks!20:15
TheAbsentOnestub: I tried pgbouncer but I end up with the same thing. "Unable to connect to PostgreSQL server: FATAL: pg_hba.conf rejects connection for host..." Not sure what I'm missing here20:57
TheAbsentOnealso kwmonroe I'm not getting it to work buddy; ip = hookenv.network_get(endpoint) ; ip["ingress-addresses"][0] for the actual ip right? Or am I messing things up? :/21:11
TheAbsentOnewelp it's gonna be for in a couple of hours gonna catch some Zzzz's22:05

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!