mirror of
https://github.com/saltstack/salt.git
synced 2025-04-16 17:50:20 +00:00
add 2.6 support
This commit is contained in:
parent
39159cc6cb
commit
e32ba10365
1 changed files with 50 additions and 7 deletions
|
@ -21,8 +21,12 @@ Quickstart for creating an/or extending the functionality of your SaltStack inst
|
|||
'''
|
||||
import logging
|
||||
from salt.scripts import salt_extend
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
PY26 = sys.version_info[0] == 2 and sys.version_info[1] == 6
|
||||
|
||||
|
||||
def _parse_args_argparse():
|
||||
import argparse
|
||||
|
||||
parser = argparse.ArgumentParser(description="Quickly boilerplate an extension to SaltStack")
|
||||
|
@ -50,11 +54,50 @@ if __name__ == '__main__':
|
|||
"--debug",
|
||||
help="Display detailed logs whilst applying templates",
|
||||
action="store_true")
|
||||
args = parser.parse_args()
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def _parse_args_optparse():
|
||||
from optparse import OptionParser
|
||||
|
||||
parser = OptionParser(usage="Quickly boilerplate an extension to SaltStack")
|
||||
parser.add_option(
|
||||
"--extension",
|
||||
"-e",
|
||||
help="Extension type, e.g. 'module', 'state'.")
|
||||
parser.add_option(
|
||||
"--salt-directory",
|
||||
"-o",
|
||||
help="Directory where your salt installation is kept (defaults to .).")
|
||||
parser.add_option(
|
||||
"--name",
|
||||
"-n",
|
||||
help="Module name.")
|
||||
parser.add_option(
|
||||
"--description",
|
||||
"-d",
|
||||
help="Short description of what the module does.")
|
||||
parser.add_option(
|
||||
"--no-merge",
|
||||
help="Don't merge the module into the salt directory, keep in a temp location",
|
||||
action="store_true")
|
||||
parser.add_option(
|
||||
"--debug",
|
||||
help="Display detailed logs whilst applying templates",
|
||||
action="store_true")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if PY26:
|
||||
(args, _) = _parse_args_optparse()
|
||||
else:
|
||||
args = _parse_args_argparse()
|
||||
if args.debug:
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
salt_extend(extension=args.extension,
|
||||
name=args.name,
|
||||
description=args.description,
|
||||
salt_dir=args.salt_directory,
|
||||
merge=not args.no_merge)
|
||||
salt_extend(
|
||||
extension=args.extension,
|
||||
name=args.name,
|
||||
description=args.description,
|
||||
salt_dir=args.salt_directory,
|
||||
merge=not args.no_merge)
|
||||
|
|
Loading…
Add table
Reference in a new issue