Skip to content

Commit

Permalink
Add --user to submit as well
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-blanchard committed Jan 16, 2018
1 parent b2f14da commit 422d889
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 9 deletions.
7 changes: 7 additions & 0 deletions streamparse/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,13 @@ def add_timeout(parser):
'(default: %(default)s)')


def add_user(parser):
""" Add --user option to parser """
parser.add_argument('--user',
help='User argument to sudo when deleting files.',
default='root')


def add_wait(parser):
""" Add --wait option to parser """
parser.add_argument('--wait',
Expand Down
1 change: 1 addition & 0 deletions streamparse/cli/remove_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def subparser_hook(subparsers):
add_override_name(subparser)
add_pattern(subparser)
add_pool_size(subparser)
# Not using add_user because we need -u for backward compatibility
subparser.add_argument('-u', '--user',
help="User argument to sudo when deleting logs.",
default='root')
Expand Down
12 changes: 8 additions & 4 deletions streamparse/cli/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
from .common import (add_ackers, add_config, add_debug, add_environment,
add_name, add_options, add_override_name,
add_overwrite_virtualenv, add_pool_size, add_requirements,
add_timeout, add_wait, add_workers, resolve_options)
add_timeout, add_user, add_wait, add_workers,
resolve_options)
from .jar import jar_for_deploy
from .kill import _kill_topology
from .list import _list_topologies
Expand Down Expand Up @@ -144,7 +145,7 @@ def submit_topology(name=None, env_name=None, options=None, force=False,
wait=None, simple_jar=True, override_name=None,
requirements_paths=None, local_jar_path=None,
remote_jar_path=None, timeout=None, config_file=None,
overwrite_virtualenv=False):
overwrite_virtualenv=False, user='root'):
"""Submit a topology to a remote Storm cluster."""
config = get_config()
name, topology_file = get_topology_definition(name, config_file=config_file)
Expand Down Expand Up @@ -180,7 +181,8 @@ def submit_topology(name=None, env_name=None, options=None, force=False,
virtualenv_name=virtualenv_name,
requirements_paths=requirements_paths,
config_file=config_file,
overwrite_virtualenv=overwrite_virtualenv)
overwrite_virtualenv=overwrite_virtualenv,
user=user)
streamparse_run_path = '/'.join([env.virtualenv_root, virtualenv_name,
'bin', 'streamparse_run'])
# Update python paths in bolts
Expand Down Expand Up @@ -276,6 +278,7 @@ def subparser_hook(subparsers):
'components in your topology. Useful if you '
'are providing your own seriailzer class.',
dest='simple_jar', action='store_false')
add_user(subparser)
add_wait(subparser)
add_workers(subparser)

Expand All @@ -292,4 +295,5 @@ def main(args):
remote_jar_path=args.remote_jar_path,
timeout=args.timeout,
config_file=args.config,
overwrite_virtualenv=args.overwrite_virtualenv)
overwrite_virtualenv=args.overwrite_virtualenv,
user=args.user)
8 changes: 3 additions & 5 deletions streamparse/cli/update_virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

from .common import (add_config, add_environment, add_name, add_options,
add_override_name, add_overwrite_virtualenv,
add_pool_size, add_requirements, resolve_options)
add_pool_size, add_requirements, add_user,
resolve_options)
from ..util import (activate_env, die, get_config, get_env_config,
get_topology_definition, get_topology_from_file)

Expand Down Expand Up @@ -134,10 +135,7 @@ def subparser_hook(subparsers):
add_override_name(subparser)
add_pool_size(subparser)
add_requirements(subparser)
subparser.add_argument('-u', '--user',
help="User argument to sudo when deleting "
"virtualenv for --overwrite_virtualenv.",
default='root')
add_user(subparser)


def main(args):
Expand Down

0 comments on commit 422d889

Please sign in to comment.