-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/37398/
-----------------------------------------------------------

Review request for Ambari, Mahadev Konar and Srimanth Gunturi.


Bugs: AMBARI-12747
    https://issues.apache.org/jira/browse/AMBARI-12747


Repository: ambari


Description
-------

The issue of not extracting the jar is because of the following:

* *serverUpgrade.py* has a method "upgrade", which deletes only the admin view 
directory for upgrade between 1.7.0  & 2.0.0, 
 
```
admin_views_dirs = get_admin_views_dir(properties)
  for admin_views_dir in admin_views_dirs:
    shutil.rmtree(admin_views_dir)
```


* *serverSetup.py*, has a method extract_views which internally calls the 
ViewExtractor - 

```
VIEW_EXTRACT_CMD = "{0} -cp {"org.apache.ambari.server.view.ViewRegistry 
extract {2} "> " + configDefaults.SERVER_OUT_FILE + " 2>&1"
```


The fix would require removing existing view directories and extracting the 
views by using the extract_views in the upgrade script. The removal of 
directories is must because currently the ViewExtractor skips, if the archive 
directory exists, as under:
*ViewExtractor.java*
  
```
// Skip if the archive has already been extracted
            if (!archiveDir.exists()) {
```

Therefore, the fix is done within the upgrade step, where a new method to 
delete the extracted jars is added. The work directory therefore removes all 
the exploded view artifacts. At the time of server restart the extract_view 
method calls the ViewExtractor, and since the directory is not present, it 
explodes the jar into the work directory.


Diffs
-----

  ambari-server/src/main/python/ambari_server/serverConfiguration.py 8ad6c9c 
  ambari-server/src/main/python/ambari_server/serverUpgrade.py 2ab4c94 

Diff: https://reviews.apache.org/r/37398/diff/


Testing
-------

Tested upgrade scripts on local VMs for:
- Dummy upgrade without changing repository artifact. Checked that the exploded 
artifacts are getting deleted and recreated
- Upgraded Ambari server 2.0 to 2.1 version.


Thanks,

Rohit Choudhary

Reply via email to