canonical / jhack

Chock-full of Juju hackery.
Apache License 2.0
51 stars 24 forks source link

Fix shell syntax error during "jhack fire" with --env #28

Closed benhoyt closed 1 year ago

benhoyt commented 1 year ago
$ jhack fire database/0 secret-rotate --env JUJU_SECRET_ID=cdu2c3js26oc760lq4h0
ERROR:jhack.simulate_event:cmd juju ssh database/0 /usr/bin/juju-exec -u database/0 ('JUJU_SECRET_ID=cdu2c3js26oc760lq4h0',) ./dispatch terminated with 1
ERROR:jhack.simulate_event:stdout=b'sh: 1: Syntax error: "(" unexpected\r\n'
ERROR:jhack.simulate_event:stderr=b'ERROR command terminated with exit code 2\n'
Fired secret-rotate on database/0.
PietroPasotti commented 1 year ago

Thanks! good catch :) I was wondering whether there's any quality-of-life / syntactic glazing automation we can offer for secret events, for example: jhack fire [<secret label>]-secret-rotate --> automatically fetch the ID and inject it in the ENV... Would that be useful?

benhoyt commented 1 year ago

Yeah, I was wondering about that too. Secret labels are a bit weird though, as a secret can have both consumer and owner labels. Perhaps you could add --secret-id and --secret-label args for that event. Or perhaps what you have now is enough, but you could add some usage examples for these events to the help.