private String setEnvVarCommand(VMInstance vmi, String varName, String value){ if (!vmi.getType().getOs().toLowerCase().contains("windows")) { //String command="echo export "+varName+"="+value+" >> ~/.bashrc"; //jc.execCommand(vmi.getId(), command, "ubuntu", vmi.getType().getPrivateKey()); return "sudo sh -c 'echo export "+varName+"="+value+" >> /etc/environment';"; } else { //TODO: should we do something for Windows as well? } return ""; }
public PuppetMarionnetteConnector(String endpoint, VMInstance vmi){ this.endpoint=endpoint; this.isWindows=(vmi.getType().getOs().toLowerCase().contains("windows")); }
private OSVirtualHardDisk createOSVHD(VM vm,String storageAccountName, String storageContainer){ int random = (int)(Math.random()* 100); URI mediaLinkUriValue = null; try { mediaLinkUriValue = new URI("http://"+ storageAccountName + ".blob.core.windows.net/"+storageContainer+ "/ubuntu" + random +".vhd"); String osVHarddiskName ="ubuntuoshdname"+ random; String operatingSystemName ="Linux"; if(!vm.getOs().equals("")) if(vm.getOs().toLowerCase().contains("win")) operatingSystemName="Windows"; String sourceImageName = "Ubuntu"; if(!vm.getImageId().equals("")) sourceImageName=vm.getImageId(); else if(!vm.getOs().equals("")) sourceImageName = getOSSourceImage(vm.getOs()); OSVirtualHardDisk oSVirtualHardDisk = new OSVirtualHardDisk(); //required oSVirtualHardDisk.setName(osVHarddiskName); oSVirtualHardDisk.setHostCaching(VirtualHardDiskHostCaching.READWRITE); oSVirtualHardDisk.setOperatingSystem(operatingSystemName); //required oSVirtualHardDisk.setMediaLink(mediaLinkUriValue); //required oSVirtualHardDisk.setSourceImageName(sourceImageName); return oSVirtualHardDisk; } catch (Exception e) { e.printStackTrace(); } return null; }
if (!owner.getType().getOs().toLowerCase().contains("windows")) { jc.execCommand(owner.getId(), command, "ubuntu", owner.getType().getPrivateKey()); } else {
private void setEnvVar(VMInstance vmi, String cmd){ if (!vmi.getType().getOs().toLowerCase().contains("windows")) { //String command="echo export "+varName+"="+value+" >> ~/.bashrc"; Connector jc = ConnectorFactory.createIaaSConnector(vmi.getType().getProvider()); jc.execCommand(vmi.getId(), cmd, "ubuntu", vmi.getType().getPrivateKey()); jc.closeConnection(); } else { //TODO: should we do something for Windows as well? } }
public void setEnvVar(VMInstance vmi, String varName, String value){ if (!vmi.getType().getOs().toLowerCase().contains("windows")) { //String command="echo export "+varName+"="+value+" >> ~/.bashrc"; Connector jc = ConnectorFactory.createIaaSConnector(vmi.getType().getProvider()); //jc.execCommand(vmi.getId(), command, "ubuntu", vmi.getType().getPrivateKey()); String command3="sudo sh -c 'echo export "+varName+"="+value+" >> /etc/environment'"; jc.execCommand(vmi.getId(), command3, "ubuntu", vmi.getType().getPrivateKey()); jc.closeConnection(); } else { //TODO: should we do something for Windows as well? } }
ConfigurationSet configurationSet = new ConfigurationSet(); String type=ConfigurationSetTypes.LINUXPROVISIONINGCONFIGURATION; if(!vm.getOs().equals("")) if(vm.getOs().toLowerCase().contains("win")) type=ConfigurationSetTypes.WINDOWSPROVISIONINGCONFIGURATION; configurationSet.setConfigurationSetType(type);
if (vm.getOs().toLowerCase().contains("windows")) { while(!PowerShellConnector.checkConnectivity(ip.getUuid())){ try {
@Override public String toString() { return "VMInstance: " + getName() + " Type:" + getType().getName() + "{\n" + "minRam:" + (getType()).getMinRam() + "\n" + "minCore" + (getType()).getMinCores() + "\n" + "minDisk" + (getType()).getMinStorage() + "\n" + "OS" + (getType()).getOs() + "\n" + "location" + (getType()).getLocation() + "\n" + "publicAdress" + getPublicAddress() + "\n" + "groupName" + (getType()).getGroupName(); }