[Plugin] sync-watch: Edit locally, run in the cloud

Cory Johns cory.johns at canonical.com
Mon Apr 27 13:33:24 UTC 2015


Writing plugins for Juju is actually quite easy in general, and this
particular plugin is not terribly complicated, as it uses pyinotify
which does most of the heavy lifting.  (Note that you may need to
install the pyinotify library if updating an existing install of
juju-plugins.)  The trickiest part was getting the changes onto the
unit, because we didn't want to use upgrade-charm, since it would
affect all units and trigger a hook, but juju scp can't directly
overwrite the charm, because it doesn't run as root.  So, I had to scp
into a temp directory and then use juju ssh to copy the files over
using sudo.  https://github.com/juju/plugins/blob/master/juju-sync-watch#L120

On Fri, Apr 24, 2015 at 5:21 PM, Eric Snow <eric.snow at canonical.com> wrote:
> This is great, Cory (and Ben)!  Out of curiosity, what were the
> trickiest parts of writing the plugin?  Also, what aspects/components
> of juju's architecture helped and hindered you?
>
> -eric
>
> On Fri, Apr 24, 2015 at 6:34 AM, Cory Johns <cory.johns at canonical.com> wrote:
>> Last week, while in Nuremberg, Ben and I were able to create a new
>> plugin to enable a much better charm development workflow.
>>
>> Once the Juju Plugins bundle (https://github.com/juju/plugins) is
>> installed, you can now run `juju sync-watch <unit>` to enable local
>> editing of a remote charm.  This works using inotify to watch for
>> changes in the local copy of the charm and automatically sync those
>> changes up to the deployed unit.  If the unit is in an error state, it
>> will also automatically retry the failed hook, so that you can do
>> fast, seamless iteration on a charm.
>>
>> This plugin works with any provider and any editor.
>>
>> --
>> Juju mailing list
>> Juju at lists.ubuntu.com
>> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju



More information about the Juju mailing list