Update trigger to config

This commit is contained in:
Darko Poljak 2019-01-28 16:46:40 +01:00
parent a0247479ec
commit 054020ee44
3 changed files with 60 additions and 44 deletions

View file

@ -441,11 +441,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'))
@ -453,7 +450,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)

View file

@ -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

View file

@ -87,12 +87,12 @@ SYNOPSIS
cdist shell [-h] [-l LOGLEVEL] [-q] [-v] [-s SHELL]
cdist trigger [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-C CACHE_PATH_PATTERN]
[-c CONF_DIR] [-i MANIFEST] [-j [JOBS]] [-n]
[-o OUT_PATH] [-R [{tar,tgz,tbz2,txz}]]
[-r REMOTE_OUT_PATH] [--remote-copy REMOTE_COPY]
[--remote-exec REMOTE_EXEC] [-6] [-D DIRECTORY]
[-H HTTP_PORT] [-S SOURCE]
cdist trigger [-h] [-l LOGLEVEL] [-q] [-v] [-b] [-g CONFIG_FILE] [-4]
[-6] [-C CACHE_PATH_PATTERN] [-c CONF_DIR] [-i MANIFEST]
[-j [JOBS]] [-n] [-o OUT_PATH] [-P]
[-R [{tar,tgz,tbz2,txz}]] [-r REMOTE_OUT_PATH]
[--remote-copy REMOTE_COPY] [--remote-exec REMOTE_EXEC]
[-S] [-D DIRECTORY] [-H HTTP_PORT] [--ipv6] [-O SOURCE]
DESCRIPTION
@ -633,64 +633,76 @@ This command returns the following response codes to client requests:
* 599 for cdist run errors
* 500 for cdist/server errors.
**-4, -force-ipv4**
Force to use IPv4 addresses only. No influence for
custom remote commands.
**-6, --ipv6**
Listen to both IPv4 and IPv6 (instead of only IPv4)
**-b, --beta**
Enable beta functionality.
**-6, --force-ipv6**
Force to use IPv6 addresses only. No influence for
custom remote commands.
**-C CACHE_PATH_PATTERN, --cache-path-pattern CACHE_PATH_PATTERN**
Sepcify custom cache path pattern. It can also be set by
CDIST_CACHE_PATH_PATTERN environment variable. If it is not set then
default hostdir is used. For more info on format see
:strong:`CACHE PATH PATTERN FORMAT` below.
Specify custom cache path pattern. If it is not set
then default hostdir is used.
**-c CONF_DIR, --conf-dir CONF_DIR**
Add configuration directory (can be repeated, last one wins)
Add configuration directory (can be repeated, last one
wins).
**-D DIRECTORY, --directory DIRECTORY**
Where to create local files
**-H HTTP_PORT, --http-port HTTP_PORT**
**-g CONFIG_FILE, --config-file CONFIG_FILE**
Use specified custom configuration file.
**-H HTTP_PORT, --http-port HTTP_PORT**
Create trigger listener via http on specified port
**-i MANIFEST, --initial-manifest MANIFEST**
Path to a cdist manifest or '-' to read from stdin.
path to a cdist manifest or '-' to read from stdin.
**--ipv6**
Listen to both IPv4 and IPv6 (instead of only IPv4)
**-j [JOBS], --jobs [JOBS]**
Specify the maximum number of parallel jobs, currently
only global explorers are supported
Operate in parallel in specified maximum number of
jobs. Global explorers, object prepare and object run
are supported. Without argument CPU count is used by
default. Currently in beta.
**-n, --dry-run**
Do not execute code.
do not execute code
**-O SOURCE, --source SOURCE**
Which file to copy for creation
**-o OUT_PATH, --out-dir OUT_PATH**
Directory to save cdist output in.
directory to save cdist output in
**-P, --timestamp**
Timestamp log messages with the current local date and
time in the format: YYYYMMDDHHMMSS.us.
**-R [{tar,tgz,tbz2,txz}], --use-archiving [{tar,tgz,tbz2,txz}]**
Operate by using archiving with compression where
appropriate. Supported values are: tar - tar archive,
tgz - gzip tar archive (the default), tbz2 - bzip2 tar
archive and txz - lzma tar archive. Currently in beta.
**-r REMOTE_OUT_PATH, --remote-out-dir REMOTE_OUT_PATH**
Directory to save cdist output in on the target host
Directory to save cdist output in on the target host.
**--remote-copy REMOTE_COPY**
Command to use for remote copy (should behave like scp)
Command to use for remote copy (should behave like
scp).
**--remote-exec REMOTE_EXEC**
Command to use for remote execution (should behave
like ssh).
Command to use for remote execution (should behave like ssh)
**-S, --disable-saving-output-streams**
Disable saving output streams.
**-S SOURCE, --source SOURCE**
Which file to copy for creation
CONFIGURATION
-------------