My applications reside in a yum repository so I'd like to try and use glu's agent to run a "yum install" command.
What would be the best way to do so?
Just playing around, I figured I might just search for a way to execute linux command and hopefully try a "sudo yum install xxx" and hope it'd work.
Alternatively, if that doesn't work then maybe "ssh -t root@localhost 'yum install xxx'" and maybe I need to share a key before that or something and hopefully that would work... if not I'm at a dead end...
If that's just rubbish then what's the recommended way of doing a yum install with the agent?
I like to be able to use yum b/c it's self contained, has versions and can also be run independently of glu.
Yes it is an oversight. You get an instance of ShellImpl in the glu script so it works. I had so many things to do for the open source release that I never copied the methods in the interface. I created an issue to keep track of it: https://github.com/linkedin/glu/issues/issue/5
Regarding your question, I am not familiar with how 'yum' works exactly. To execute any command you want from the glu script you simply do:
Thanks Yan, I was able to pull this out.
1. I run the agent as root (required by yum)
2. In the install phase I execute: shell.exec("yum install -y ImageServer");
Related question, this also works for me:
String output = "yum install -y ImageServer").execute().text.
Is shell.exec just a thin wrapper around this sort of command or does it add more goodness? Which of the two approaches is recommended?