-
Notifications
You must be signed in to change notification settings - Fork 41
Bug - Fix CLI login error #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
b150f86
8e7a76a
c4de155
3f48e45
a47c715
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -58,6 +58,7 @@ | |||||||||
| import com.mirth.connect.client.core.PaginatedEventList; | ||||||||||
| import com.mirth.connect.client.core.PaginatedMessageList; | ||||||||||
| import com.mirth.connect.client.core.PropertiesConfigurationUtil; | ||||||||||
| import com.mirth.connect.client.core.UnauthorizedException; | ||||||||||
| import com.mirth.connect.donkey.model.channel.DeployedState; | ||||||||||
| import com.mirth.connect.donkey.model.message.ContentType; | ||||||||||
| import com.mirth.connect.donkey.model.message.Message; | ||||||||||
|
|
@@ -179,10 +180,21 @@ private void runShell(String server, String user, String password, String script | |||||||||
| client = new Client(server); | ||||||||||
| this.debug = debug; | ||||||||||
|
|
||||||||||
| LoginStatus loginStatus = client.login(user, password); | ||||||||||
|
|
||||||||||
| if (loginStatus.getStatus() != LoginStatus.Status.SUCCESS) { | ||||||||||
| error("Could not login to server.", null); | ||||||||||
| LoginStatus loginStatus; | ||||||||||
| try { | ||||||||||
| loginStatus = client.login(user, password); | ||||||||||
| } catch (UnauthorizedException ex) { | ||||||||||
| if (ex.getResponse() instanceof LoginStatus status) { | ||||||||||
| loginStatus = status; | ||||||||||
| } | ||||||||||
| else { | ||||||||||
| error("Could not login to server.", ex); | ||||||||||
| return; | ||||||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
77 is the unix exit code for EX_NOPERM. This code is already using exit code 2 for usage errors. |
||||||||||
| } | ||||||||||
| } | ||||||||||
|
|
||||||||||
| if (!loginStatus.isSuccess()) { | ||||||||||
| error("Could not login to server. Status: " + loginStatus.getStatus(), null); | ||||||||||
| return; | ||||||||||
|
Comment on lines
+197
to
198
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
77 is the unix exit code for EX_NOPERM. This code is already using exit code 2 for usage errors. |
||||||||||
| } | ||||||||||
|
|
||||||||||
|
|
||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes below will complain that loginStatus may have not been initialized without this.