Have ansible yell if no module name is supplied
parent
edf6da5c38
commit
1427ade3af
|
@ -18,6 +18,7 @@
|
||||||
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
import sys
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import getpass
|
import getpass
|
||||||
|
@ -35,7 +36,7 @@ class Cli(object):
|
||||||
def runner(self):
|
def runner(self):
|
||||||
parser = base_ans_parser()
|
parser = base_ans_parser()
|
||||||
parser.add_option("-n", "--name", dest="module_name",
|
parser.add_option("-n", "--name", dest="module_name",
|
||||||
help="module name to execute", default=C.DEFAULT_MODULE_NAME)
|
help="module name to execute", default=None)
|
||||||
parser.add_option("-a", "--args", dest="module_args",
|
parser.add_option("-a", "--args", dest="module_args",
|
||||||
help="module arguments", default=C.DEFAULT_MODULE_ARGS)
|
help="module arguments", default=C.DEFAULT_MODULE_ARGS)
|
||||||
parser.add_option('-o', '--one-line', dest='one_line', action='store_true',
|
parser.add_option('-o', '--one-line', dest='one_line', action='store_true',
|
||||||
|
@ -45,6 +46,10 @@ class Cli(object):
|
||||||
|
|
||||||
options, args = parser.parse_args()
|
options, args = parser.parse_args()
|
||||||
|
|
||||||
|
if options.module_name is None:
|
||||||
|
print >> sys.stderr, "-n is required"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
# TODO: more shell like splitting on module_args would
|
# TODO: more shell like splitting on module_args would
|
||||||
# be a good idea
|
# be a good idea
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue