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

appropriately handling option parsing by adding '--'s and removing '--'s #35

Open
wants to merge 1 commit into
base: glue-0.9
Choose a base branch
from
Open
Changes from all commits
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
8 changes: 6 additions & 2 deletions awsglue/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def error(self, msg):
raise GlueArgumentError(msg)


def strip_option_prefix(option):
return option.lstrip('--')


def getResolvedOptions(args, options):
parser = GlueArgumentParser()

Expand All @@ -78,12 +82,12 @@ def getResolvedOptions(args, options):
parser.add_argument(option, required=False)

for option in Job.id_params()[1:]:
if option in options:
if strip_option_prefix(option) in options:
raise RuntimeError("Using reserved arguments " + option)
# TODO: Make these mandatory, for now for backward compatability making these optional, also not including JOB_NAME in the reserved parameters list.
parser.add_argument(option, required=False)

if Job.encryption_type_options()[0] in options:
if strip_option_prefix(Job.encryption_type_options()[0]) in options:
raise RuntimeError("Using reserved arguments " + Job.encryption_type_options()[0])
parser.add_argument(Job.encryption_type_options()[0], choices = Job.encryption_type_options()[1:])

Expand Down