Skip to content
This repository was archived by the owner on Aug 29, 2018. It is now read-only.

Commit 3b5dcf0

Browse files
Bug1311730: Fixing short-form optparse options
Bug 1311730 BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1311730 Errors were being seen when command line tools using the 'optparse' libary. Using long-form only options with a single dash was resulting in odd returns, but no errors. This is because optparse automatically infers a short-form option for long-form options that have a unique starting letter. So '--ids' has an implied short-form of '-i'. This meant that running a command with '-ids' would actually use '-i' and pass in "ds" as an ID value. This commit takes several cases where this happens and explicitely defines the short-form options in the relevant scripts and man pages, which should reduce confusion on why certain options may not error out as expected. Also updates an old man page to reflect the current options.
1 parent 5754c02 commit 3b5dcf0

13 files changed

+60
-43
lines changed

broker-util/man/oo-admin-broker-auth.8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
.nf
88
.fam C
99
\fBoo-admin-broker-auth\fP [\fB-h\fP|\fB--help\fP] [\fB-t\fP|\fB--timeout\fP \fIinteger\fP]
10-
[\fB--find-gears\fP] [\fB--verbose\fP] [\fB--dryrun\fP] [\fB--rekey-all\fP] [\fB--rekey\fP \fIuuid\fP]
10+
[\fB--find-gears\fP] [\fB--verbose\fP] [\fB--dryrun\fP] [\fB--rekey-all\fP] [\fB-r\fP|\fB--rekey\fP \fIuuid\fP]
1111

1212
.fam T
1313
.fi
@@ -34,7 +34,7 @@ Print out gears with using Broker key authentication.
3434
\fB--dryrun\fP
3535
Show what would be done. Useful for finding discrepancies in Nodes reported by the Broker datastore and the message bus.
3636
.PP
37-
\fB--verbose\fP
37+
\fB-v\fP|\fB--verbose\fP
3838
Show debugging information
3939
.SH EXAMPLE
4040

broker-util/man/oo-admin-ctl-app.8

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\" Text automatically generated by txt2man
2-
.TH oo-admin-ctl-app 8 "15 September 2014" "" ""
2+
.TH oo-admin-ctl-app 8 "20 May 2016" "" ""
33
.SH NAME
44
\fBoo-admin-ctl-app
55
\fB
@@ -29,6 +29,9 @@ Login with OpenShift access. Required.
2929
.B
3030
\fB-a\fP|\fB--app\fP \fIapp_name\fP
3131
Application name, alphanumeric. Required.
32+
.PP
33+
\fB-n\fP|\fB--domain\fP domain
34+
Domain name.
3235
.TP
3336
.B
3437
\fB-c\fP|\fB--command\fP \fIcmd\fP
@@ -51,6 +54,9 @@ Alias to operate on.
5154
.B
5255
\fB-b\fP|\fB--bypass\fP
5356
Ignore all warnings.
57+
.PP
58+
\fB--multiplier\fP multiplier
59+
Multiplier factor to be set for the cartridge.
5460
.SH EXAMPLE
5561

5662
$ \fBoo-admin-ctl-app\fP \fB-l\fP mylogin \fB-a\fP myappname \fB-c\fP status

broker-util/man/oo-admin-ctl-app.txt2man

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ OPTIONS
1818

1919
-a|--app app_name
2020
Application name, alphanumeric. Required.
21+
22+
-n|--domain domain
23+
Domain name.
2124

2225
-c|--command cmd
2326
Command to envoke upon the application, available commands are: start,
@@ -36,6 +39,9 @@ OPTIONS
3639
-b|--bypass
3740
Ignore all warnings.
3841

42+
--multiplier multiplier
43+
Multiplier factor to be set for the cartridge.
44+
3945
EXAMPLE
4046

4147
$ oo-admin-ctl-app -l mylogin -a myappname -c status

broker-util/man/oo-admin-ctl-cartridge.8

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\" Text automatically generated by txt2man
2-
.TH oo-admin-ctl-cartridge 8 "17 September 2014" "" ""
2+
.TH oo-admin-ctl-cartridge 8 "20 May 2016" "" ""
33
.SH NAME
44
\fBoo-admin-ctl-cartridge
55
\fB
@@ -59,11 +59,11 @@ This is an administrative utility to manage cartridges.
5959
\fB-h\fP|\fB--help\fP
6060
Display a simple usage page.
6161
.PP
62-
\fB--dry-run\fP
62+
\fB-d\fP|\fB--dry-run\fP
6363
Display the results of running an operation, but do not make any changes
6464
to the database.
6565
.PP
66-
\fB--raw\fP
66+
\fB-r\fP|\fB--raw\fP
6767
When outputting cartridge information, display each manifest as JSON
6868
.PP
6969
\fB-a\fP|\fB--active\fP
@@ -78,26 +78,26 @@ A comma-delimited list of cartridge names. Used by the "delete" command.
7878
\fB--all\fP
7979
Display all information
8080
.PP
81-
\fB--ids\fP IDS
81+
\fB-i\fP|\fB--ids\fP IDS
8282
ID for a cartridge version to activate or deactivate (comma-delimited).
8383
.PP
8484
\fB--node\fP NODE
8585
With import-node, server-identity for a node to import from.
8686
.PP
87-
\fB--profile\fP PROFILES
87+
\fB-p\fP|\fB--profile\fP PROFILES
8888
With import-profile, profile to import from (may be comma-separated list).
8989
.PP
9090
\fB-u\fP|\fB--url\fP URL
9191
URL of a cartrige manifest to import.
9292
.PP
93-
\fB--broker\fP PATH
93+
\fB-b\fP|\fB--broker\fP PATH
9494
The path to the broker (default /var/www/openshift/broker/config/environment)
9595
.PP
96-
\fB--force\fP
96+
\fB-f\fP|\fB--force\fP
9797
By default, import and import-node will skip unchanged cartridges. Use this
9898
switch to force them to create a new version.
9999
.PP
100-
\fB--obsolete\fP
100+
\fB-o\fP|\fB--obsolete\fP
101101
By default, obsolete cartridges will not be activated. Use this switch to
102102
automatically update obsolete cartridges.
103103
.PP

broker-util/man/oo-admin-ctl-cartridge.txt2man

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ OPTIONS
4848
-h|--help
4949
Display a simple usage page.
5050

51-
--dry-run
51+
-d|--dry-run
5252
Display the results of running an operation, but do not make any changes
5353
to the database.
5454

55-
--raw
55+
-r|--raw
5656
When outputting cartridge information, display each manifest as JSON
5757

5858
-a|--active
@@ -67,26 +67,26 @@ OPTIONS
6767
--all
6868
Display all information
6969

70-
--ids IDS
70+
-i|--ids IDS
7171
ID for a cartridge version to activate or deactivate (comma-delimited).
7272

7373
--node NODE
7474
With import-node, server-identity for a node to import from.
7575

76-
--profile PROFILES
76+
-p|--profile PROFILES
7777
With import-profile, profile to import from (may be comma-separated list).
7878

7979
-u|--url URL
8080
URL of a cartrige manifest to import.
8181

82-
--broker PATH
82+
-b|--broker PATH
8383
The path to the broker (default /var/www/openshift/broker/config/environment)
8484

85-
--force
85+
-f|--force
8686
By default, import and import-node will skip unchanged cartridges. Use this
8787
switch to force them to create a new version.
8888

89-
--obsolete
89+
-o|--obsolete
9090
By default, obsolete cartridges will not be activated. Use this switch to
9191
automatically update obsolete cartridges.
9292

broker-util/man/oo-app-info.8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.\" Text automatically generated by txt2man
2-
.TH untitled "07 November 2013" "" ""
2+
.TH untitled "20 May 2016" "" ""
33
.SH NAME
44
\fBoo-app-info
55
\fB
@@ -47,7 +47,7 @@ Comma-delimited list of Application or Gear uuids or regular expressions
4747
Additional:
4848
\fB--deleted\fP
4949
Look for deleted Applications
50-
\fB--raw\fP
50+
\fB-r\fP or \fB--raw\fP
5151
Print raw data structure without formatting.
5252
.RE
5353
.PP

broker-util/man/oo-app-info.txt2man

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ OPTIONS
3333
Additional:
3434
--deleted
3535
Look for deleted Applications
36-
--raw
36+
-r or --raw
3737
Print raw data structure without formatting.
3838

3939

broker-util/oo-admin-broker-auth

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ oo-admin-broker-auth OPTIONS
3434
Options:
3535
--rekey-all
3636
Rekey all Gears using Broker authentication tokens
37-
--rekey [uuid]
37+
-r|--rekey [uuid]
38+
Rekey an individual gear
3839
-t|--timeout [integer]
3940
How long to wait for MCollective Node discovery
4041
-v|--verbose

broker-util/oo-admin-ctl-cartridge

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -540,20 +540,20 @@ or names.
540540
options.command = command
541541
end
542542

543-
opts.on('--broker PATH', "The path to the broker",
543+
opts.on('-b', '--broker PATH', "The path to the broker",
544544
" (default #{PATH})") do |path|
545545
options.broker = path
546546
end
547547

548-
opts.on('--raw', "Dump all cartridge information as JSON") do
548+
opts.on('-r', '--raw', "Dump all cartridge information as JSON") do
549549
options.raw = true
550550
end
551551

552-
opts.on('--force', "Replace with new version even if unchanged") do
552+
opts.on('-f', '--force', "Replace with new version even if unchanged") do
553553
options.force = true
554554
end
555555

556-
opts.on('--obsolete', "Force activation of obsolete cartridges") do
556+
opts.on('-o', '--obsolete', "Force activation of obsolete cartridges") do
557557
options.obsolete = true
558558
end
559559

@@ -565,7 +565,7 @@ or names.
565565
options.activate = true
566566
end
567567

568-
opts.on('--dry-run', "Show the results of the update without changing anything.") do
568+
opts.on('-d', '--dry-run', "Show the results of the update without changing anything.") do
569569
options.dry_run = true
570570
end
571571

@@ -581,7 +581,7 @@ or names.
581581
options.quiet = true
582582
end
583583

584-
opts.on('--ids IDS', "ID for a cartridge version to activate or deactivate (comma-delimited).") do |ids|
584+
opts.on('-i', '--ids IDS', "ID for a cartridge version to activate or deactivate (comma-delimited).") do |ids|
585585
options.ids = ids.split(/[\, ]/)
586586
end
587587

broker-util/oo-app-info

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ if $0 == __FILE__
8585
opts.separator ''
8686
opts.separator 'Additional:'
8787
opts.on('--deleted', 'Look for deleted Applications') { params[:deleted] = true }
88-
opts.on('--raw', 'Print raw data structure without formatting.') { params[:raw] = true }
88+
opts.on('r', '--raw', 'Print raw data structure without formatting.') { params[:raw] = true }
8989
end
9090
optparse.parse!
9191

0 commit comments

Comments
 (0)