Closed binocarlos closed 9 years ago
You're supposed to put the base command options before the subcommand On 7 Jun 2015 18:01, "Kai Davenport" notifications@github.com wrote:
I was using flocker-volumes.py without a cluster.yml so was wanting to configure:
- --control-service
- --certs-path
Each time I would get this output:
$ ./flocker-volumes.py list --control-service=df option --control-service not recognized Try --help for usage details.
From reading this page https://twistedmatrix.com/documents/13.1.0/core/howto/options.html#auto2 it says:
However, usage.Options uses special reflection code to get all of the optFlags defined in the hierarchy.
So this PR has a FlockerVolumesBaseCommands that has the global optParameters. Each subCommand inherits from this class as well as the main Options parser FlockerVolumesCommands
With this patch when I do this command it works:
$ ./flocker-volumes.py list \ --control-service=172.16.255.250 \ --certs-path=/Users/kai/projects/test-flocker-cluster/_files DATASET SIZE METADATA STATUS SERVER ba659448 0.20G name=volume1433696089.47 attached 430e9391 (172.16.255.251) b3190cde 0.20G name=volume16:51:55.719099 attached 430e9391 (172.16.255.251) 6391c50a 0.20G name=volume1.43369610991e+12 attached 430e9391 (172.16.255.251) 9b0e1751 0.20G name=apples attached 430e9391 (172.16.255.251) 1c96e658
name=peaches2 attached 430e9391 (172.16.255.251) 7f94532e 0.20G name=volume1433696125 attached 430e9391 (172.16.255.251) I'm not sure if this is how you are supposed to do it but is has meant the
flags work for me now :-)
You can view, comment on, or merge this pull request online at:
https://github.com/ClusterHQ/unofficial-flocker-tools/pull/8 Commit Summary
- Create a base Options class that has the global optParameters
File Changes
- M flocker-volumes.py https://github.com/ClusterHQ/unofficial-flocker-tools/pull/8/files#diff-0 (80)
Patch Links:
- https://github.com/ClusterHQ/unofficial-flocker-tools/pull/8.patch
- https://github.com/ClusterHQ/unofficial-flocker-tools/pull/8.diff
— Reply to this email directly or view it on GitHub https://github.com/ClusterHQ/unofficial-flocker-tools/pull/8.
Ahhhh I see - so you mean:
$ ./flocker-volumes.py \
--control-service=172.16.255.250 \
--certs-path=/Users/kai/projects/test-flocker-cluster/_files \
list
Which totally works. Dups! - I feel stupid - well, I'm learning a lot of Python in the process :-) Closing!
No problem. We should make it clearer that that is the expected order of things. Like make the error text that tripped you up mention it. Or clearly document some examples which includes these options. WDYT?
Perhaps have an example like this in the output of ./flocker-volumes.py --help
?
A prototype version of a CLI tool which shows off flocker's first class
volumes capabilities.
Run me from a directory containing a cluster.yml and appropriate cluster
certificates, or specify --certs-path, --cluster-crt, --user-crt, --user-key, and
--control-service.
./flocker-volumes.py [global-options] <command> [options]
./flocker-volumes.py --control-service=1.2.3.4 --certs-path=~/mycerts list --long --deleted
I was using
flocker-volumes.py
without acluster.yml
so was wanting to configure:Each time I would get this output:
From reading this page it says:
So this PR has a
FlockerVolumesBaseCommands
that has the globaloptParameters
. Each subCommand inherits from this class as well as the main Options parserFlockerVolumesCommands
With this patch when I do this command it works:
I'm not sure if this is how you are supposed to do it but is has meant the flags work for me now :-)