Writing a plugin in Go and attempting to re-create what a normal 'juju run' would do
Here is my code: https://github.com/battlemidget/juju-learnyouaplugin/blob/master/main.go However, running it produces: > juju lyaplugin --machine 1 "ls /" master [9d8856f] 2015-04-22 14:52:27 INFO juju.api api.go:280 connecting to API addresses: [localhost:17070 10.0.3.1:17070 192.168.0.100:17070 192.168.122.1:17070] 2015-04-22 14:52:27 INFO juju.api apiclient.go:331 dialing "wss://localhost:17070/environment/70815eb1-b324-4555-897e-fdd0ce0030a5/api" 2015-04-22 14:52:27 INFO juju.api apiclient.go:263 connection established to "wss://localhost:17070/environment/70815eb1-b324-4555-897e-fdd0ce0030a5/api" 2015-04-22 14:52:28 INFO juju.plugin.lyaplugin main.go:86 Running cmd: ls / on machine: 1 2015-04-22 14:52:28 INFO juju.plugin.lyaplugin main.go:99 Run result: (0) () () Where as `juju run --machine 1 "ls /"` shows the root level directories. Any insight on what I'm missing is appreciated. Another note is I'm not quite sure if there is an alternative to getting the current running environment other than doing a `juju switch local` then running the plugin pulling in envcmd.GetDefaultEnvironment, seen here: https://github.com/battlemidget/juju-learnyouaplugin/blob/master/main.go#L73 This plugin is for learning purposes and I plan on writing an article for others to write their own plugins so any best practices/recommendations/feedback on this is welcomed! Thanks -- [ Adam Stokes ]
-- Juju-dev mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/juju-dev
