[ 
https://issues.apache.org/jira/browse/AMBARI-23827?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tim Thorpe updated AMBARI-23827:
--------------------------------
    Description: 
Update extension link doesn't persist to the Ambari DB.  The REST API will 
return the proper results but the DB won't be altered.  This results in the 
extension link reverting to the previous extension after an Ambari server 
restart.

Here are the reproduction steps:
 * Install ambari-server
 * Install 2 versions of an extension - just the extension definitions with 
their service definitions
 * Restart ambari-server
 * Link the 1st version of the extension
 * Update the extension link to the 2nd version of the extension
 * Verify the Ambari DB
 * Restart ambari-server
 * Verify the list of links via the REST API (post restart)

 * 
 ## Link the 1st version*
 [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' *-X POST* -d 
'{"ExtensionLink": {"stack_name": "HDP", "stack_version": "2.5", 
"extension_name": "IBM-Big_SQL", *"extension_version": "5.0.2.0"*}}' 
[http://node1.fyre.ibm.com:8080/api/v1/links/]

 * 
 ## Verify the extension link created*
 [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
[http://node1.fyre.ibm.com:8080/api/v1/links/]
 {
   "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
   "items" : [
    
Unknown macro: \{      "href" }
  ]
 }

 * 
 ## Update the link to the 2nd extension version*
 [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' *-X PUT* -d 
'{"ExtensionLink": {"stack_name": "HDP", "stack_version": "2.5", 
"extension_name": "IBM-Big_SQL", *"extension_version": "5.0.3.0"*}}' 
[http://node1.fyre.ibm.com:8080/api/v1/links/1]

 * 
 ## Verify the extension link is updated*
 [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
[http://node1.fyre.ibm.com:8080/api/v1/links/]                                  
  {
   "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
   "items" : [
    
Unknown macro: \{      "href" }
  ]
 }

 # *Verify the Ambari DB*
 ambari=> select * from stack where stack_version = '2.5';
  stack_id | stack_name |  stack_version
 ----------++-----------------------------
         6 | HDP        | 2.5

ambari=> select * from extension;
  extension_id | extension_name | extension_version
 --------------++-----------------------------------
             1 | IBM-Big_SQL    | 5.0.3.0
             *2 | IBM-Big_SQL    | 5.0.2.0*

*ambari=> select * from extensionlink;*
  *link_id | stack_id | {color:#ff0000}extension_id{color}*
 *---------++------------------------*
        *1 |        6 |           {color:#ff0000} 2
 >> Extension link is still listed as IBM-Big_SQL 5.0.2.0.{color}
 *
 
 
 *# Verify the extension link after ambari-server restart*
 [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
[http://node1.fyre.ibm.com:8080/api/v1/links/]
 {
   "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
   "items" : [
     {
       "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/1";,
       "ExtensionLink" : {
         *"extension_name" : "IBM-Big_SQL",*
         *"extension_version" : "5.0.2.0",*
         *"link_id" : 1,*
         "stack_name" : "HDP",
         "stack_version" : "2.5"
       }
     }
   ]
 }
 *>> Extension link is back to IBM-Big_SQL 5.0.2.0 via REST API.*

  was:
Update extension link doesn't persist to the Ambari DB.  The REST API will 
return the proper results but the DB won't be altered.  This results in the 
extension link reverting to the previous extension after an Ambari server 
restart.

Here are the reproduction steps:
 * Install ambari-server
 * Install 2 versions of an extension
 * Restart ambari-server
 * Link the 1st version of the extension
 * Update the extension link to the 2nd version of the extension
 * Verify the Ambari DB
 * Restart ambari-server
 * Verify the list of links via the REST API (post restart)

*# Link the 1st version*
[root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' *-X POST* -d 
'{"ExtensionLink": {"stack_name": "HDP", "stack_version": "2.5", 
"extension_name": "IBM-Big_SQL", *"extension_version": "5.0.2.0"*}}' 
http://node1.fyre.ibm.com:8080/api/v1/links/

*# Verify the extension link created*
[root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
http://node1.fyre.ibm.com:8080/api/v1/links/
{
  "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
  "items" : [
    {
      "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/1";,
      "ExtensionLink" : {
        *"extension_name" : "IBM-Big_SQL",*
        *"extension_version" : "5.0.2.0",*
        *"link_id" : 1,*
        "stack_name" : "HDP",
        "stack_version" : "2.5"
      }
    }
  ]
}

*# Update the link to the 2nd extension version*
[root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' *-X PUT* -d 
'{"ExtensionLink": {"stack_name": "HDP", "stack_version": "2.5", 
"extension_name": "IBM-Big_SQL", *"extension_version": "5.0.3.0"*}}' 
http://node1.fyre.ibm.com:8080/api/v1/links/1

*# Verify the extension link is updated*
[root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
http://node1.fyre.ibm.com:8080/api/v1/links/                                    
{
  "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
  "items" : [
    {
      "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/1";,
      "ExtensionLink" : {
        *"extension_name" : "IBM-Big_SQL",*
        *"extension_version" : "5.0.3.0",*
        *"link_id" : 1,*
        "stack_name" : "HDP",
        "stack_version" : "2.5"
      }
    }
  ]
}

# *Verify the Ambari DB*
ambari=> select * from stack where stack_version = '2.5';
 stack_id | stack_name |  stack_version
----------+------------+-----------------
        6 | HDP        | 2.5

ambari=> select * from extension;
 extension_id | extension_name | extension_version
--------------+----------------+-------------------
            1 | IBM-Big_SQL    | 5.0.3.0
            *2 | IBM-Big_SQL    | 5.0.2.0*

*ambari=> select * from extensionlink;*
 *link_id | stack_id | {color:#FF0000}extension_id{color}*
*---------+----------+--------------*
       *1 |        6 |           {color:#FF0000} 2
{color:#333333}>> Extension link is still listed as IBM-Big_SQL 5.0.2.0.{color}
{color}*


*# Verify the extension link after ambari-server restart*
[root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
http://node1.fyre.ibm.com:8080/api/v1/links/
{
  "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
  "items" : [
    {
      "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/1";,
      "ExtensionLink" : {
        *"extension_name" : "IBM-Big_SQL",*
{color:#FF0000}        *"extension_version" : "5.0.2.0",*{color}
        *"link_id" : 1,*
        "stack_name" : "HDP",
        "stack_version" : "2.5"
      }
    }
  ]
}
*>> Extension link is back to IBM-Big_SQL 5.0.2.0 via REST API.*


> Update extension link doesn't persist to the Ambari DB
> ------------------------------------------------------
>
>                 Key: AMBARI-23827
>                 URL: https://issues.apache.org/jira/browse/AMBARI-23827
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 2.6.0, 2.7.0
>            Reporter: Tim Thorpe
>            Priority: Major
>
> Update extension link doesn't persist to the Ambari DB.  The REST API will 
> return the proper results but the DB won't be altered.  This results in the 
> extension link reverting to the previous extension after an Ambari server 
> restart.
> Here are the reproduction steps:
>  * Install ambari-server
>  * Install 2 versions of an extension - just the extension definitions with 
> their service definitions
>  * Restart ambari-server
>  * Link the 1st version of the extension
>  * Update the extension link to the 2nd version of the extension
>  * Verify the Ambari DB
>  * Restart ambari-server
>  * Verify the list of links via the REST API (post restart)
>  * 
>  ## Link the 1st version*
>  [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' *-X POST* -d 
> '{"ExtensionLink": {"stack_name": "HDP", "stack_version": "2.5", 
> "extension_name": "IBM-Big_SQL", *"extension_version": "5.0.2.0"*}}' 
> [http://node1.fyre.ibm.com:8080/api/v1/links/]
>  * 
>  ## Verify the extension link created*
>  [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
> [http://node1.fyre.ibm.com:8080/api/v1/links/]
>  {
>    "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
>    "items" : [
>     
> Unknown macro: \{      "href" }
>   ]
>  }
>  * 
>  ## Update the link to the 2nd extension version*
>  [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' *-X PUT* -d 
> '{"ExtensionLink": {"stack_name": "HDP", "stack_version": "2.5", 
> "extension_name": "IBM-Big_SQL", *"extension_version": "5.0.3.0"*}}' 
> [http://node1.fyre.ibm.com:8080/api/v1/links/1]
>  * 
>  ## Verify the extension link is updated*
>  [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
> [http://node1.fyre.ibm.com:8080/api/v1/links/]                                
>     {
>    "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
>    "items" : [
>     
> Unknown macro: \{      "href" }
>   ]
>  }
>  # *Verify the Ambari DB*
>  ambari=> select * from stack where stack_version = '2.5';
>   stack_id | stack_name |  stack_version
>  ----------++-----------------------------
>          6 | HDP        | 2.5
> ambari=> select * from extension;
>   extension_id | extension_name | extension_version
>  --------------++-----------------------------------
>              1 | IBM-Big_SQL    | 5.0.3.0
>              *2 | IBM-Big_SQL    | 5.0.2.0*
> *ambari=> select * from extensionlink;*
>   *link_id | stack_id | {color:#ff0000}extension_id{color}*
>  *---------++------------------------*
>         *1 |        6 |           {color:#ff0000} 2
>  >> Extension link is still listed as IBM-Big_SQL 5.0.2.0.{color}
>  *
>  
>  
>  *# Verify the extension link after ambari-server restart*
>  [root@node1 ~]# curl -u admin:admin -H 'X-Requested-By: ambari' -X GET 
> [http://node1.fyre.ibm.com:8080/api/v1/links/]
>  {
>    "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/";,
>    "items" : [
>      {
>        "href" : "http://node1.fyre.ibm.com:8080/api/v1/links/1";,
>        "ExtensionLink" : {
>          *"extension_name" : "IBM-Big_SQL",*
>          *"extension_version" : "5.0.2.0",*
>          *"link_id" : 1,*
>          "stack_name" : "HDP",
>          "stack_version" : "2.5"
>        }
>      }
>    ]
>  }
>  *>> Extension link is back to IBM-Big_SQL 5.0.2.0 via REST API.*



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to