-
Notifications
You must be signed in to change notification settings - Fork 151
Make import of 'user' data possible #586
base: master
Are you sure you want to change the base?
Conversation
Sollid stuff @jomeier! |
@john-westcott-iv |
My apologies for the delay, I have been exceptionally busy over the last month. I'm not sure this is going to be the best way to fix this issue, and I think we still need to do some more troubleshooting to determine is something is going awry with your AWX installation as most users don't seem to be getting this problem. The way the receive process is supposed to work is that TowerCLI should be asking the API about the fields for a given asset type (i.e. a user) and then determining what to output based on this. To get the required field information TowerCLI sends an HTTP OPTIONS call to the assets API end point. In the case of a user object it would be an OPTIONS call to /api/v2/users. You can do this in the UI by doing a GET on /api/v2/users and then clicking the OPTIONS button in the upper right. The result should look something like this:
TowerCLI then uses the POST action to decide which fields are required to build a new user (based on the required tag) and what the default value is for any optional fields. After it gets this data, TowerCLI makes an API call to get the users themselves (via stepping through the pages of GET requests to /api/v2/users/). For each user it receives it will look at the fields of the user and match those fields to the fields in the OPTIONS call. A required field is always added to the output; an optional field whose value does not match the default value is also printed in the output. The API_POST_OPTIONS field you are modifying was intended to handle a very specific case where performing an HTTP OPTIONS call on /api/v2/schedules does not return a POST action. By hard coding a user object in here if the definition of a user asset changed in a future version of AWX TowerCLI would have to be updated in order to handle the new fields. So again, I think we really need to determine what exactly is going on. In the small amount of time I was able to devote to this issue I did download a couple different versions of AWX but was unable to replicate the issue. Can you post the result of an HTTP OPTIONS call for /api/v2/users? This can be done with curl using this syntax: In addition, can you get the data about the admin user from the API with this curl command: Please be sure to run these two commands form the same machine you are running TowerCLI from. That way, if there is something between your TowerCLI and AWX installation we will capture the correct results. As a side note, if run receive with -v it will show you messages regarding what calls it is making to AWX:
|
I get this with WARNING: Asset type user has no API POST options no pre-checks can be performed I get this on a fresh install of awx docker images 1.0.8 |
Seems like a bug in 1.0.x? that is fixed in 2.0.1? receiving from AWX 1.0.7.2:
Whilst the same (tower-cli version) on 2.0.1:
|
@TwoTwenty Thanks for the post. Are you running the export command as Admin? There may be issues where if you are running as a non-prived user you don't see the POST options. |
I'm having the same problem with the export, however the very first time I ran the command it worked and now (minutes later) it is not working. I've checked the User List options in my browser and it does contain the POST section within actions. I've also tried running the curl options command and also see the POST section. I modified my common.py to dump out the value in What I've narrowed it down to is my |
I have the exact same issue. Thanks for posting your findings. That worked. Tower-cli login does not work. |
Hi,
I'm working on an tower export/import script and try to use tower-cli for that.
Here: #581
I describe a problem, where the export of 'user' data and the reimport with the same! data doesn't work. Some required fields (like email, first and last name, ...) are missing in the export.
This PR should fix that. For some reason some required fields are not exported with:
Best regards,
Josef