delphix / dxtoolkit

Scripts that remotely interact with Delphix engine APIs
Apache License 2.0
38 stars 32 forks source link

"December 9th 2020: Not able to add a MSSQL dSource using Environment user to connect to source DB" #165

Closed carloscuellar87d closed 3 years ago

carloscuellar87d commented 3 years ago

Expected Behavior As part of the dx_ctl_dsource command, there is an option when creating a MSSQL dSource to indicate that you will use the environment user to connect to source DB (-dbusertype environment) which should allow us to specify just the environment user to be used to create this dsource.

Actual Behavior As part of the dx_ctl_dsource command, there is an option when creating a MSSQL dSource to indicate that you will use the environment user to connect to source DB (-dbusertype environment), but when trying to use it the command does not work and forces you to add dbuser and password. Even adding these values, when debugging this command, we can see that the API called formed still goes with standard "db account" option.

Steps To Reproduce the Problem This is an example execution in my local lab: ./dx_ctl_dsource -d engine -type mssql -sourcename TEST -sourceinst MSSQLSERVER -sourceenv WINTARGET -source_os_user "delphix" -dbusertype environment -group dSources -dsourcename TEST -stage_os_user "delphix" -stageinst MSSQLSERVER - stageenv WINTARGET -action create Options -dbuser and -password are required for non vFiles dsources.

Then tried adding the real env user as dbuser with the proper password and still failed: /dx_ctl_dsource -d engine -type mssql -sourcename TEST -sourceinst MSSQLSERVER -sourceenv WINTARGET -source_os_user "delphix" -dbusertype environment -group dSources -dsourcename TEST -stage_os_user "delphix" -stageinst MSSQLSERVER - stageenv WINTARGET -action create -creategroup -dbuser delphix -password delphix Username or password is invalid. There were problems with dSource action. No job defined.

Version Tested in MacOS Catalina 10.15.7 with dxtoolkit 2.4.8

carloscuellar87d commented 3 years ago

Hello,

I tested with 2.4.9 but unfortunately it did not work the way i was expecting it:

Command --> ./dx_ctl_dsource -d engine -type mssql -sourcename TEST -sourceinst MSSQLSERVER -sourceenv WINTARGET -source_os_user delphix -dbusertype environment -group dSources -dsourcename TEST -stage_os_user delphix -stageinst MSSQLSERVER - stageenv WINTARGET -dbuser delphix -password delphix -action create --debug 3

Output --> {"type":"MSSqlSourceConfigConnectivity","mssqlUser":{"user":"delphix","type":"MSSqlEnvironmentUser"}} ** POST http://172.16.126.242:80/resources/json/delphix/sourceconfig/MSSQL_SINGLE_CONFIG-11/validateCredentials ==> 200 OK -Response message: { "status" : "ERROR", "error" : { "id" : "exception.validation.bad.input", "diagnoses" : null, "type" : "APIError", "commandOutput" : null, "details" : { "mssqlUser" : { "user" : { "action" : null, "commandOutput" : null, "details" : "The provided string \"delphix\" is not a valid object reference.", "diagnoses" : null, "id" : "exception.validation.format.object_reference.invalid" } } }, "action" : "Check your input parameters and try again." }, "type" : "ErrorResult" }

validateCredentials API is expecting a User Reference.

If I run it using the delphix reference, it works fine --> ./dx_ctl_dsource -d engine -type mssql -sourcename TEST -sourceinst MSSQLSERVER -sourceenv WINTARGET -source_os_user delphix -dbusertype environment -group dSources -dsourcename TEST -stage_os_user delphix -stageinst MSSQLSERVER - stageenv WINTARGET -dbuser HOST_USER-3 -password delphix -action create

It is a minor issue since it works fine with the reference :)

When you have a moment, can you please help me have a look into it?

Thanks in advance and regards

marcinops commented 3 years ago

Fixed in 2.4.11 - with dbusertype set environment no need to provide a user anymore other users will be handled as well