jcftang / strider

Spins up dev/test VMs and bakes cloud images.
Apache License 2.0
17 stars 1 forks source link

IDEA: allow for unkown args #4

Open gkspranger opened 8 years ago

gkspranger commented 8 years ago

i might be going about this wrong, but i want to create a reusable "provisioner" strider.py file .. be more DRY .. but this means i need to be able to pass it arguments .. such as "--role" or whatever .. so i went ahead and added this code to the top of my strider.py file ..

import argparse
parser = argparse.ArgumentParser(description='create, provision, bake')
parser.add_argument('--role', help='web', required=True)
ddargs, ddleftovers = parser.parse_known_args()

but as you can imagine, strider gets mad at me and says:

[yoyoma@air ~/git/dumbodata]$python strider_web.py --role web --up
EC2: EBS property: size => 10
EC2: EBS property: volume_type => gp2
EC2: EBS property: size => 10
EC2: EBS property: volume_type => gp2
EC2: connecting...
EC2: connected
usage: strider_web.py [-h] [--up] [--provision] [--ssh] [--destroy] [--bake]
                      [--auto-teardown]
strider_web.py: error: unrecognized arguments: --role web

so i was hoping you all might be willing to allow unknown args to be passed in ?? not the most awesome python guy here -- but it does seem related to: https://github.com/jcftang/strider/blob/master/lib/strider/__init__.py

line 89

thoughts ?? and thanks for maintaining this .. it's so dang convenient vs having to do the packer/vagrant dance ..

jcftang commented 8 years ago

Actually, yea that sounds like a good idea. I am interested to migrate to using gflags so you can just provide your own flags and things will happen automagically