Help save net neutrality! Learn more.
Close

#290 Add remote API (XML-RPC, whatever)

open
nobody
None
5
2012-02-28
2012-02-28
No

I have scripts that need to invoke FOG to make certain deploys. These are run in an automated fashion (cron etc). We were unable to find APIs that would allow us to perform these operations. I wonder if it would be possible to add this kind of support, using whatever mechanism is easier (XML-RPC, REST, whatever).

Here is a quick hack a junior developer did at audaces.com.br which uses Selenium to drive FOG via the web GUI:

public class FogClientDeploy extends SeleneseTestCase {

public static int codeTestMachineOnFog;
public static int codeHostImageOnFog;

public void setUp() throws Exception {
setUp("http://fog/", "*firefox");
}

public void accessFogManagementServer() throws Exception {
selenium.open("/fog/management/index.php");
selenium.waitForPageToLoad("5000");
selenium.type("uname", "fog");
selenium.type("upass", "password");
selenium.click("//input[@value='Login']");
selenium.waitForPageToLoad("15000");
}

public void accessFogConfigureHostImage() throws Exception {
selenium.open("/fog/management/index.php?node=host&sub=edit&id="+codeTestMachineOnFog);
selenium.waitForPageToLoad("5000");
selenium.select("image", "value="+codeHostImageOnFog);
selenium.click("//input[@value='Update']");
selenium.waitForPageToLoad("5000");
//selenium.click("//input[@value='OK']");
}

private void setDeployWindowsTaskToTestMachine() {
selenium.open("/fog/management/index.php?node=tasks&sub=&debug=&confirm="+codeTestMachineOnFog+"&type=host&direction=down");
}

public void activateTestMachineToDeploy() throws Exception {
accessFogManagementServer();
accessFogConfigureHostImage();
setDeployWindowsTaskToTestMachine();

}

public void testMagic() throws Exception {
activateTestMachineToDeploy();
}

public static void main(String[] args) {
org.junit.runner.JUnitCore.main("com.foo.fog.FogClientDeploy");
}

}

You get the idea - we are doing it for 1, full of hardcoded values. It would be nice to have an API which I could call from my scripts and have the system perform the operations I need.

Thanks for listening.

marcio (mqm)

Discussion


Log in to post a comment.