CLI and REST API calls are giving different results for /sourconfig

  • 0
  • 1
  • Problem
  • Updated 2 years ago
  • Solved
I am not getting some values in the API response /resources/json/delphix/sourceconfig?environment=UNIX_HOST_ENVIRONMENT-14 however they were shown when executed in CLI.
When provisioning mysql vdb, db expects unique portno. I wanted to run through all existing ports and pick next port(3312; assuming i have ports from 3308 to 3311) by calling REST API 
Eg: 
API Response: 
{"type":"ListResult","status":"OK","result":[{"type":"SourceConfig","reference":"MYSQL_SERVER_CONFIG-22","namespace":null,"name":"/var/tmp/delphix/provision/VNTLS_QA_MYSQL_SRC-FVK/datafile","linkingEnabled":true,"discovered":false,"environmentUser":"HOST_USER-28","repository":"MYSQL_INSTALL-4"},
.....}

CLI Response:
{    "type": "ListResult",
    "status": "OK",
    "result": [
        {
            "type": "MySQLServerConfig",
            "reference": "MYSQL_SERVER_CONFIG-22",
            "namespace": null,
            "name": "/var/tmp/delphix/provision/VNTLS_QA_MYSQL_SRC-FVK/datafile",
            "linkingEnabled": true,
            "discovered": false,
            "environmentUser": "HOST_USER-28",
            "repository": "MYSQL_INSTALL-4",
            "dataDirectory": "/var/tmp/delphix/provision/VNTLS_QA_MYSQL_SRC-FVK/datafile",
            "port": 3308,
            "user": "xxxxx",
            "credentials": {
                "type": "PasswordCredential",
                "password": "***********"
            }
        },
......}
From the above 2 results, portno, user, etc are missing in API. 
We are using DE 5.0.2.3 version. Is this a bug in this version?
Photo of Viswas Patnala

Viswas Patnala

  • 512 Points 500 badge 2x thumb

Posted 2 years ago

  • 0
  • 1
Photo of Neal Stack

Neal Stack, Employee

  • 2,762 Points 2k badge 2x thumb
Official Response
Hi Viswas,

Do you set the current API version in your script? Check what the current version is from the CLI with `/version`.

For example, I have:

#!/bin/bash# Set API version
curl -s -X POST -k --data @- http://nstack503.dcenter.delphix.com/resources/json/delphix/session \
    -c ~/cookies.txt -H "Content-Type: application/json" <<EOF
{
    "type": "APISession",
    "version": {
        "type": "APIVersion",
        "major": 1,
        "minor": 8,
        "micro": 1
    }
}
EOF

# Login
echo -e "\n"
curl -s -X POST -k --data @- http://nstack503.dcenter.delphix.com/resources/json/delphix/login \
    -b ~/cookies.txt -H "Content-Type: application/json" <<EOF
{
    "type": "LoginRequest",
    "username": "delphix_admin",
    "password": "delphix"
}
EOF

# List MySQL sourceconfig
echo -e "\n\nListing MySQL sourceconfig..."
curl -X GET -k http://nstack503.dcenter.delphix.com/resources/json/delphix/sourceconfig/MYSQL_SERVER_CONFIG-18 \
    -b ~/cookies.txt -H "Content-Type: application/json"

Which results in:

Listing MySQL sourceconfig...
{"type":"OKResult","status":"OK","result":{"type":"MySQLServerConfig","reference":"MYSQL_SERVER_CONFIG-18","namespace":null,"name":"/opt/mysql57/mysql-5.7.10-linux-glibc2.5-x86_64_e/data","linkingEnabled":true,"discovered":true,"environmentUser":"HOST_USER-45","repository":"MYSQL_INSTALL-16","dataDirectory":"/opt/mysql57/mysql-5.7.10-linux-glibc2.5-x86_64_e/data","port":3321,"user":"delphix1","credentials":{"type":"PasswordCredential","password":"********"}},"job":null,"action":null}

I tested with Delphix 5.1.3 but sometimes not setting the API version correctly produces different results.

Thanks,
  Neal