Skip to content

Invocation Defaults doesn't work for "--users file" #381

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

Closed
vossen-adobe opened this issue Aug 13, 2018 · 9 comments
Closed

Invocation Defaults doesn't work for "--users file" #381

vossen-adobe opened this issue Aug 13, 2018 · 9 comments

Comments

@vossen-adobe
Copy link
Contributor

vossen-adobe commented Aug 13, 2018

When trying to use the users key in user-sync-config.yml in the following way:

For argument --users, the default is 'all'.
users: file users-file.csv

The following error is encountered:

2018-08-13 09:02:48 18248 CRITICAL main - Unknown option "file users-file.csv" for users

The same string works on the command line.

@Luci2015
Copy link
Collaborator

Luci2015 commented Aug 13, 2018

[removing last comment]

oops, if it's user action maybe would be needed inside adobe_only_user_action.

@vossen-adobe
Copy link
Contributor Author

It's because multiple args are not parsed from the config file. Currently working on a fix

vossen-adobe pushed a commit that referenced this issue Aug 13, 2018
Invocation Defaults for user-sync-config now parsed if they are list type correctly.  Added small parser for ID to do this.
@Luci2015
Copy link
Collaborator

I don't think you need to do this change as it was not intended to be run along users attribute, but connector one.

Here is how I run with command line:
2018-08-22 02:48:23 2824 INFO main - ------- Command line arguments -------
2018-08-22 02:48:23 2824 INFO main - --users file users-file.csv -t
2018-08-22 02:48:23 2824 DEBUG main - -------- Resulting invocation options --------
2018-08-22 02:48:23 2824 DEBUG main - adobe_only_user_action: ['remove']
2018-08-22 02:48:23 2824 DEBUG main - adobe_only_user_list: None
2018-08-22 02:48:23 2824 DEBUG main - connector: ['ldap']
2018-08-22 02:48:23 2824 DEBUG main - process_groups: True
2018-08-22 02:48:23 2824 DEBUG main - strategy: sync
2018-08-22 02:48:23 2824 DEBUG main - test_mode: True
2018-08-22 02:48:23 2824 DEBUG main - update_user_info: False
2018-08-22 02:48:23 2824 DEBUG main - user_filter: None
2018-08-22 02:48:23 2824 DEBUG main - users: ['all']
2018-08-22 02:48:23 2824 DEBUG main - directory_connector_type: csv
2018-08-22 02:48:23 2824 DEBUG main - remove_strays: True
2018-08-22 02:48:23 2824 DEBUG main - directory_connector_overridden_options: {'file_path': 'users-file.csv'}

Here is how I run with invocation_defaults only:
2018-08-22 02:49:19 3740 INFO main - ------- Command line arguments -------
2018-08-22 02:49:19 3740 INFO main - -t
2018-08-22 02:49:19 3740 DEBUG main - -------- Resulting invocation options --------
2018-08-22 02:49:19 3740 DEBUG main - adobe_only_user_action: ['remove']
2018-08-22 02:49:19 3740 DEBUG main - adobe_only_user_list: None
2018-08-22 02:49:19 3740 DEBUG main - connector: ['csv', 'users-file.csv']
2018-08-22 02:49:19 3740 DEBUG main - process_groups: True
2018-08-22 02:49:19 3740 DEBUG main - strategy: sync
2018-08-22 02:49:19 3740 DEBUG main - test_mode: True
2018-08-22 02:49:19 3740 DEBUG main - update_user_info: False
2018-08-22 02:49:19 3740 DEBUG main - user_filter: None
2018-08-22 02:49:19 3740 DEBUG main - users: ['all']
2018-08-22 02:49:19 3740 DEBUG main - directory_connector_type: csv
2018-08-22 02:49:19 3740 DEBUG main - directory_connector_overridden_options: {'file_path': 'users-file.csv'}
2018-08-22 02:49:19 3740 DEBUG main - remove_strays: True
2018-08-22 02:49:19 3740 INFO main - -------------------------------------

Results in the log are the same.
Here is the doc file -> scroll down after the table with the available command lines.

@vossen-adobe
Copy link
Contributor Author

The intent is for it to run stand alone as well. On the command line, you can use --users file without using the CSV connector, which is an optional piece. The core of this issue is actually that any key with multiple arguments (including adob_only_user_list, for example) needed to be put in with python list syntax in order to get parsed correctly. With this fix you can use the same values on invocation_defaults with the same syntax as for the command line, which is the natural expectation for the end user.

@Luci2015
Copy link
Collaborator

I understand your intent for the change.
Does this imply that the connector "[csv, file.csv]" will not going to be used anymore as "users: file file.csv" will replace it + documentation change we currently have linked to this along with the new invocation_default setting explanation?

@vossen-adobe
Copy link
Contributor Author

Actually the csv connector was already optional with csv inputs - it just helps you customize further. All we're doing here is getting invocation defaults syntax to match the command line

@Luci2015
Copy link
Collaborator

OK, thanks :)

@adorton-adobe
Copy link
Collaborator

Invocation defaults that replace compound arguments (such as --users file users.csv) should be specified as arrays of strings. Example:

users: ['file', 'config-csv\users.csv']

This is documented in the comment block above invocation_defaults. We should perhaps add an example above users to make this clear. We also need to document invocation_defaults in the manual because I don't think it is covered at all. I've created an issue for that task - #387

I'm closing this since the sync tool is working as designed.

@janssenda
Copy link
Contributor

Whoops! My mistake for not realizing that was intended. I scoured the official docs for info at the time, but as you have mentioned - there isn't any, and I totally overlooked the new comments. Thanks for resolving this and making the docs issue!

@adorton-adobe adorton-adobe added this to the 2.4 milestone Aug 29, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants