Skip to content

Commit

Permalink
Add login to oc right after OpenShiftCliCommandExecutor is initializa…
Browse files Browse the repository at this point in the history
…ted.
  • Loading branch information
Katka92 committed Sep 26, 2018
1 parent a1c4dc4 commit e972a65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ public String execute(String command) throws IOException {
}

private void obtainKeycloakPodName() throws IOException {
openShiftCliCommandExecutor.login();

// obtain name of keycloak pod
String getKeycloakPodNameCommand =
format(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,18 @@ public class OpenShiftCliCommandExecutor implements CommandExecutor {

@Inject private OpenShiftWebConsoleUrlProvider openShiftWebConsoleUrlProvider;

@Override
public String execute(String command) throws IOException {
@Inject
private void postInitialization() throws IOException {
if (!PATH_TO_OPENSHIFT_CLI.toFile().exists()) {
downloadOpenShiftCli();
}
login();
LOG.info("Logged into an openshift as a user: " + execute("whoami"));
}

@Override
public String execute(String command) throws IOException {
String openShiftCliCommand = format("%s %s", PATH_TO_OPENSHIFT_CLI, command);

return processAgent.process(openShiftCliCommand);
}

Expand Down

0 comments on commit e972a65

Please sign in to comment.