Skip to content

Commit

Permalink
Merge pull request #188 from rundeck/issue/185
Browse files Browse the repository at this point in the history
correct rd run loglevel option fixes #185 fixes #187
  • Loading branch information
gschueler authored Jun 29, 2018
2 parents 1e129e8 + 1abca26 commit 6922f37
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ Run a Job.
[--follow -f] : Follow execution output as it runs
[--id -i value] : Run the Job with this IDENTIFIER
[--job -j value] : Job job (group and name). Run a Job specified by Job name and group. eg: 'group/name'.
[--logevel -l /(verbose|info|warning|error)/] : Run the command using the specified LEVEL. LEVEL can be verbose, info, warning, error.
[--loglevel -l /(verbose|info|warning|error)/] : Run the command using the specified LEVEL. LEVEL can be verbose, info, warning, error.
[--progress -r] : Do not echo log text, just an indicator that output is being received.
[--project -p value] : Project name
[--quiet -q] : Echo no output, just wait until the execution completes.
Expand Down Expand Up @@ -273,4 +273,4 @@ Manage user information

edit - Edit information of the same user or another if 'user' is specified
info - Get information of the same user or from another if 'user' is specified
list - Get the list of users
list - Get the list of users
10 changes: 9 additions & 1 deletion src/main/java/org/rundeck/client/tool/commands/Retry.java
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,16 @@ public boolean retry(RetryBaseOptions options, CommandOutput out) throws IOExcep
}
Execution execution;

final String loglevel;
if (options.isLogevel()) {
out.warning("--logevel is [DEPRECATED: To be removed], use --loglevel");
loglevel = options.getLogevel().toUpperCase();
} else {
loglevel = null != options.getLoglevel() ? options.getLoglevel().toUpperCase() : null;
}

ExecRetry request = new ExecRetry();
request.setLoglevel(options.getLoglevel());
request.setLoglevel(loglevel);
request.setAsUser(options.getUser());
request.setFailedNodes(options.getFailedNodes());
List<String> commandString = options.getCommandString();
Expand Down
13 changes: 11 additions & 2 deletions src/main/java/org/rundeck/client/tool/commands/Run.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,18 @@ public boolean run(RunBaseOptions options, CommandOutput out) throws IOException
}
Execution execution;
Date runat = null;

final String loglevel;
if (options.isLogevel()) {
out.warning("--logevel is [DEPRECATED: To be removed], use --loglevel");
loglevel = options.getLogevel().toUpperCase();
} else {
loglevel = null != options.getLoglevel() ? options.getLoglevel().toUpperCase() : null;
}

if (getClient().getApiVersion() >= 18) {
JobRun request = new JobRun();
request.setLoglevel(options.getLoglevel());
request.setLoglevel(loglevel);
request.setFilter(options.getFilter());
request.setAsUser(options.getUser());
List<String> commandString = options.getCommandString();
Expand Down Expand Up @@ -156,7 +165,7 @@ public boolean run(RunBaseOptions options, CommandOutput out) throws IOException
execution = apiCall(api -> api.runJob(
jobId,
Quoting.joinStringQuoted(options.getCommandString()),
options.getLoglevel(),
loglevel,
options.getFilter(),
options.getUser()
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,17 @@
@CommandLineInterface(application = "retry")
public interface RetryBaseOptions extends JobIdentOptions, FollowOptions, RetryExecutionOption {
@Option(shortName = "l",
longName = "logevel",
longName = "loglevel",
description = "Run the command using the specified LEVEL. LEVEL can be verbose, info, warning, error.",
defaultValue = {"info"},
pattern = "(verbose|info|warning|error)")
String getLoglevel();

@Option(hidden = true, pattern = "(verbose|info|warning|error)")
String getLogevel();

boolean isLogevel();


@Option(shortName = "u", longName = "user", description = "A username to run the job as, (runAs access required).")
String getUser();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
@CommandLineInterface(application = "run")
public interface RunBaseOptions extends JobIdentOptions, FollowOptions, OptionalProjectOptions, NodeFilterOptions {
@Option(shortName = "l",
longName = "logevel",
longName = "loglevel",
description = "Run the command using the specified LEVEL. LEVEL can be verbose, info, warning, error.",
defaultValue = {"info"},
pattern = "(verbose|info|warning|error)")
String getLoglevel();

@Option(hidden = true, pattern = "(verbose|info|warning|error)")
String getLogevel();

boolean isLogevel();

@Option(shortName = "u", longName = "user", description = "A username to run the job as, (runAs access required).")
String getUser();
Expand Down

0 comments on commit 6922f37

Please sign in to comment.