Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use tgt_type instead of expr_form #186

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions pepper/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,50 +200,50 @@ def add_tgtopts(self):
'''
optgroup = optparse.OptionGroup(self.parser, "Targeting Options", "Target which minions to run commands on")

optgroup.defaults.update({'expr_form': 'glob'})
optgroup.defaults.update({'tgt_type': 'glob'})

optgroup.add_option(
'-E', '--pcre', dest='expr_form', action='store_const', const='pcre',
'-E', '--pcre', dest='tgt_type', action='store_const', const='pcre',
help="Target hostnames using PCRE regular expressions",
)

optgroup.add_option(
'-L', '--list', dest='expr_form', action='store_const', const='list',
'-L', '--list', dest='tgt_type', action='store_const', const='list',
help="Specify a comma delimited list of hostnames",
)

optgroup.add_option(
'-G', '--grain', dest='expr_form', action='store_const', const='grain',
'-G', '--grain', dest='tgt_type', action='store_const', const='grain',
help="Target based on system properties",
)

optgroup.add_option(
'--grain-pcre', dest='expr_form', action='store_const', const='grain_pcre',
'--grain-pcre', dest='tgt_type', action='store_const', const='grain_pcre',
help="Target based on PCRE matches on system properties",
)

optgroup.add_option(
'-I', '--pillar', dest='expr_form', action='store_const', const='pillar',
'-I', '--pillar', dest='tgt_type', action='store_const', const='pillar',
help="Target based on pillar values",
)

optgroup.add_option(
'--pillar-pcre', dest='expr_form', action='store_const', const='pillar_pcre',
'--pillar-pcre', dest='tgt_type', action='store_const', const='pillar_pcre',
help="Target based on PCRE matches on pillar values"
)

optgroup.add_option(
'-R', '--range', dest='expr_form', action='store_const', const='range',
'-R', '--range', dest='tgt_type', action='store_const', const='range',
help="Target based on range expression",
)

optgroup.add_option(
'-C', '--compound', dest='expr_form', action='store_const', const='compound',
'-C', '--compound', dest='tgt_type', action='store_const', const='compound',
help="Target based on compound expression",
)

optgroup.add_option(
'-N', '--nodegroup', dest='expr_form', action='store_const', const='nodegroup',
'-N', '--nodegroup', dest='tgt_type', action='store_const', const='nodegroup',
help="Target based on a named nodegroup",
)

Expand Down Expand Up @@ -498,7 +498,7 @@ def parse_cmd(self, api):
if len(args) < 2:
self.parser.error("Command or target not specified")

low['tgt_type'] = self.options.expr_form
low['tgt_type'] = self.options.tgt_type
low['tgt'] = args.pop(0)
low['fun'] = args.pop(0)
low['batch'] = self.options.batch
Expand Down Expand Up @@ -540,7 +540,7 @@ def parse_cmd(self, api):
if len(args) < 2:
self.parser.error("Command or target not specified")

low['tgt_type'] = self.options.expr_form
low['tgt_type'] = self.options.tgt_type
low['tgt'] = args.pop(0)
low['fun'] = args.pop(0)
low['batch'] = self.options.batch
Expand Down
18 changes: 9 additions & 9 deletions pepper/libpepper.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def low(self, lowstate, path='/'):
'''
return self.req(path, lowstate)

def local(self, tgt, fun, arg=None, kwarg=None, expr_form='glob',
def local(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob',
the-glu marked this conversation as resolved.
Show resolved Hide resolved
timeout=None, ret=None):
'''
Run a single command using the ``local`` client
Expand All @@ -326,8 +326,8 @@ def local(self, tgt, fun, arg=None, kwarg=None, expr_form='glob',
if kwarg:
low['kwarg'] = kwarg

if expr_form:
low['expr_form'] = expr_form
if tgt_type:
low['tgt_type'] = tgt_type

if timeout:
low['timeout'] = timeout
Expand All @@ -337,7 +337,7 @@ def local(self, tgt, fun, arg=None, kwarg=None, expr_form='glob',

return self.low([low])

def local_async(self, tgt, fun, arg=None, kwarg=None, expr_form='glob',
def local_async(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob',
timeout=None, ret=None):
'''
Run a single command using the ``local_async`` client
Expand All @@ -356,8 +356,8 @@ def local_async(self, tgt, fun, arg=None, kwarg=None, expr_form='glob',
if kwarg:
low['kwarg'] = kwarg

if expr_form:
low['expr_form'] = expr_form
if tgt_type:
low['tgt_type'] = tgt_type

if timeout:
low['timeout'] = timeout
Expand All @@ -367,7 +367,7 @@ def local_async(self, tgt, fun, arg=None, kwarg=None, expr_form='glob',

return self.low([low])

def local_batch(self, tgt, fun, arg=None, kwarg=None, expr_form='glob',
def local_batch(self, tgt, fun, arg=None, kwarg=None, tgt_type='glob',
batch='50%', ret=None):
'''
Run a single command using the ``local_batch`` client
Expand All @@ -386,8 +386,8 @@ def local_batch(self, tgt, fun, arg=None, kwarg=None, expr_form='glob',
if kwarg:
low['kwarg'] = kwarg

if expr_form:
low['expr_form'] = expr_form
if tgt_type:
low['tgt_type'] = tgt_type

if batch:
low['batch'] = batch
Expand Down