Update trigger to config
This commit is contained in:
parent
912c675903
commit
a094679173
3 changed files with 60 additions and 44 deletions
|
|
@ -473,11 +473,8 @@ def get_parsers():
|
|||
parser['trigger'] = parser['sub'].add_parser(
|
||||
'trigger', parents=[parser['loglevel'],
|
||||
parser['beta'],
|
||||
parser['common'],
|
||||
parser['config_main']])
|
||||
parser['trigger'].add_argument(
|
||||
'-6', '--ipv6', default=False,
|
||||
help=('Listen to both IPv4 and IPv6 (instead of only IPv4)'),
|
||||
action='store_true')
|
||||
parser['trigger'].add_argument(
|
||||
'-D', '--directory', action='store', required=False,
|
||||
help=('Where to create local files'))
|
||||
|
|
@ -485,7 +482,11 @@ def get_parsers():
|
|||
'-H', '--http-port', action='store', default=3000, required=False,
|
||||
help=('Create trigger listener via http on specified port'))
|
||||
parser['trigger'].add_argument(
|
||||
'-S', '--source', action='store', required=False,
|
||||
'--ipv6', default=False,
|
||||
help=('Listen to both IPv4 and IPv6 (instead of only IPv4)'),
|
||||
action='store_true')
|
||||
parser['trigger'].add_argument(
|
||||
'-O', '--source', action='store', required=False,
|
||||
help=('Which file to copy for creation'))
|
||||
|
||||
parser['trigger'].set_defaults(func=cdist.trigger.Trigger.commandline)
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ class Config(object):
|
|||
|
||||
# Determine forcing IPv4/IPv6 options if any, only for
|
||||
# default remote commands.
|
||||
if args.force_ipv:
|
||||
if hasattr(args, 'force_ipv') and args.force_ipv:
|
||||
force_addr_opt = " -{}".format(args.force_ipv)
|
||||
else:
|
||||
force_addr_opt = ""
|
||||
|
|
@ -357,10 +357,13 @@ class Config(object):
|
|||
|
||||
@staticmethod
|
||||
def _address_family(args):
|
||||
if args.force_ipv == 4:
|
||||
family = socket.AF_INET
|
||||
elif args.force_ipv == 6:
|
||||
family = socket.AF_INET6
|
||||
if hasattr(args, 'force_ipv'):
|
||||
if args.force_ipv == 4:
|
||||
family = socket.AF_INET
|
||||
elif args.force_ipv == 6:
|
||||
family = socket.AF_INET6
|
||||
else:
|
||||
family = 0
|
||||
else:
|
||||
family = 0
|
||||
return family
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue