use of com.microsoft.azuretools.docker.ui.dialogs.AzureInputDockerLoginCredsDialog in project azure-tools-for-java by Microsoft.
the class AzureSelectDockerWizard method deploy.
public String deploy() {
AzureDockerPreferredSettings dockerPreferredSettings = dockerManager.getDockerPreferredSettings();
if (dockerPreferredSettings == null) {
dockerPreferredSettings = new AzureDockerPreferredSettings();
}
dockerPreferredSettings.dockerApiName = dockerImageDescription.host.apiUrl;
dockerPreferredSettings.dockerfileOption = dockerImageDescription.predefinedDockerfile;
dockerPreferredSettings.region = dockerImageDescription.host.hostVM.region;
dockerPreferredSettings.vmSize = dockerImageDescription.host.hostVM.vmSize;
dockerPreferredSettings.vmOS = dockerImageDescription.host.hostOSType.name();
dockerManager.setDockerPreferredSettings(dockerPreferredSettings);
DefaultLoader.getIdeHelper().runInBackground(project, "Deploying Docker Container on Azure", false, true, "Deploying Web app to a Docker host on Azure...", new Runnable() {
@Override
public void run() {
try {
DefaultLoader.getIdeHelper().invokeLater(new Runnable() {
@Override
public void run() {
if (!dockerImageDescription.hasNewDockerHost) {
Session session = null;
do {
try {
// check if the Docker host is accessible
session = AzureDockerSSHOps.createLoginInstance(dockerImageDescription.host);
} catch (Exception e) {
session = null;
}
if (session == null) {
EditableDockerHost editableDockerHost = new EditableDockerHost(dockerImageDescription.host);
AzureInputDockerLoginCredsDialog loginCredsDialog = new AzureInputDockerLoginCredsDialog(PluginUtil.getParentShell(), project, editableDockerHost, dockerManager, false);
if (loginCredsDialog.open() == Window.OK) {
// Update Docker host log in credentials
dockerImageDescription.host.certVault = editableDockerHost.updatedDockerHost.certVault;
dockerImageDescription.host.hasSSHLogIn = editableDockerHost.updatedDockerHost.hasSSHLogIn;
dockerImageDescription.host.hasPwdLogIn = editableDockerHost.updatedDockerHost.hasPwdLogIn;
// AzureDockerVMOps.updateDockerHostVM(dockerManager.getSubscriptionsMap().get(dockerImageDescription.sid).azureClient, editableDockerHost.updatedDockerHost);
} else {
return;
}
}
} while (session == null);
}
// Azure azureClient = dockerManager.getSubscriptionsMap().get(dockerImageDescription.sid).azureClient;
// DockerContainerDeployTask task = new DockerContainerDeployTask(project, azureClient, dockerImageDescription);
// task.queue();
createDockerContainerDeployTask(project, dockerImageDescription, dockerManager);
}
});
} catch (Exception e) {
String msg = "An error occurred while attempting to deploy to the selected Docker host." + "\n" + e.getMessage();
PluginUtil.displayErrorDialogWithAzureMsg(PluginUtil.getParentShell(), "Failed to Deploy Web App as Docker Container", msg, e);
}
}
});
return AzureDockerUtils.getUrl(dockerImageDescription);
}
use of com.microsoft.azuretools.docker.ui.dialogs.AzureInputDockerLoginCredsDialog in project azure-tools-for-java by Microsoft.
the class AzureDockerUIResources method updateDockerHost.
public static void updateDockerHost(Shell shell, IProject project, EditableDockerHost editableDockerHost, AzureDockerHostsManager dockerManager, boolean doReset) {
DockerHost updateHost = editableDockerHost.originalDockerHost;
AzureInputDockerLoginCredsDialog loginCredsDialog = new AzureInputDockerLoginCredsDialog(PluginUtil.getParentShell(), project, editableDockerHost, dockerManager, doReset);
if (loginCredsDialog.open() == Window.OK) {
// Update Docker host log in credentials
updateHost.isUpdating = true;
DefaultLoader.getIdeHelper().runInBackground(project, String.format("Updating %s Log In Credentials", updateHost.name), false, true, String.format("Updating log in credentials for %s...", updateHost.name), new Runnable() {
@Override
public void run() {
try {
AzureDockerVMOps.updateDockerHostVM(dockerManager.getSubscriptionsMap().get(updateHost.sid).azureClient, editableDockerHost.updatedDockerHost);
updateHost.certVault = editableDockerHost.updatedDockerHost.certVault;
updateHost.hasPwdLogIn = editableDockerHost.updatedDockerHost.hasPwdLogIn;
updateHost.hasSSHLogIn = editableDockerHost.updatedDockerHost.hasSSHLogIn;
updateHost.hasKeyVault = false;
updateHost.certVault.uri = "";
updateHost.certVault.name = "";
Session session = AzureDockerSSHOps.createLoginInstance(updateHost);
AzureDockerVMOps.UpdateCurrentDockerUser(session);
updateHost.session = session;
} catch (Exception ee) {
if (AzureDockerUtils.DEBUG)
ee.printStackTrace();
log.log(Level.SEVERE, "dockerHostsEditButton.addSelectionListener", ee);
}
updateHost.isUpdating = false;
}
});
}
}
Aggregations