Skip to content

Commit 9645ecb

Browse files
committed
Merge branch 'v2'
2 parents 40b53dc + 1ac3a12 commit 9645ecb

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

user_sync/config.py

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@ def load_invocation_options(self):
173173

174174
# --users and --adobe-only-user-list conflict with each other, so we need to disambiguate.
175175
# Argument specifications override configuration options, so you must have one or the other
176-
# either as an argument or as a configured default.
177-
if self.args['users'] and self.args['adobe_only_user_list']:
176+
# either as an argument or as a configured default. For a complete check, we need to compare against
177+
# BOTH the args values AND the options values (in order to catch the invocation defaults).
178+
if (self.args['users'] or (options['users'] and options['users'] != self.invocation_defaults['users'])) \
179+
and (self.args['adobe_only_user_list'] or options['adobe_only_user_list']):
178180
# specifying both --users and --adobe-only-user-list is an error
179181
raise AssertionException('You cannot specify both a --users arg and an --adobe-only-user-list arg')
180182
elif self.args['users']:
@@ -188,20 +190,12 @@ def load_invocation_options(self):
188190
raise AssertionException('You cannot specify --adobe-only-user-list when using "push" strategy')
189191
users_spec = None
190192
stray_list_input_path = self.args['adobe_only_user_list']
191-
192-
# Check both that options['users'] exists, AND that it is not the default value before checking against
193-
# the adobe_only_user_list parameter - otherwise, defaults cause exception to be thrown unconditionally when
194-
# the user list option is specified
195-
elif (options['users'] and options['users'] != self.invocation_defaults['users']) and options['adobe_only_user_list']:
196-
raise AssertionException('You cannot configure both a default "users" option (%s) '
197-
'and a default "adobe-only-user-list" option (%s)' %
198-
(' '.join(options['users']), options['adobe_only_user_list']))
199-
elif options['users']:
200-
users_spec = options['users']
201-
stray_list_input_path = None
202193
elif options['adobe_only_user_list']:
203194
users_spec = None
204195
stray_list_input_path = options['adobe_only_user_list']
196+
elif options['users']:
197+
users_spec = options['users']
198+
stray_list_input_path = None
205199
else:
206200
raise AssertionException('You must specify either a "users" option or an "adobe-only-user-list" option.')
207201

@@ -301,7 +295,7 @@ def get_directory_connector_module_name(self):
301295
"""
302296
:rtype str
303297
"""
304-
if self.invocation_options['stray_list_input_path']:
298+
if self.invocation_options.get('stray_list_input_path', None):
305299
return None
306300
connector_type = self.invocation_options.get('directory_connector_type')
307301
if connector_type:

0 commit comments

Comments
 (0)