CCI-MOC / moc-openstack-tools

Tools for OpenStack administration, user/project management, etc.
Apache License 2.0
0 stars 8 forks source link

set search columns in config using column headers #61

Open kamfonik opened 7 years ago

kamfonik commented 7 years ago

Currently we have USER_COLUMN and PROJECT_COLUMN hard coded, we would prefer to load the header in config and then determine the index programmatically.

kamfonik commented 7 years ago

For those from MOC with access to the private repos, there was some code in this PR (never merged due to other issues) which give one approach for the headers part: https://github.com/CCI-MOC/moc/pull/54

leotomatsu commented 7 years ago

Line 215 in addusers.py USER_COLUMN = 4 can be USER_COLUMN = rows[0].index('Email Address') to be less hard-coded.

Will be looking into the config.py file tomorrow!

kamfonik commented 7 years ago

@ltomatsu good idea. There is a similar line in set-quotas.py. Can you make the change and submit a PR? If you need help navigating git/Github I can help with that this afternoon.

leotomatsu commented 7 years ago

Could I get access to the quota-sheet to see what I am header index name I am suppose to use?

Also, for the header in config, when loading the header in config, do we want a variable header and functions that can index this variable inside config that can be used as a module?

kamfonik commented 7 years ago

I gave you read access to the sheet, let me know if it didn't work. For the header, we want to be able to put a line in the config file something like this:

user_column = Email Address

And then if we changed the name of the column in the spreadsheet from "Email Adresss" to "Email" or something, we would just update the config file.

leotomatsu commented 7 years ago

Yes I got the access and I think I understand what should be in the config file.

I made a pull request #65