You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Sumit Mohanty (JIRA)" <ji...@apache.org> on 2013/07/02 19:01:22 UTC

[jira] [Commented] (AMBARI-2542) Custom Repo URL cannot be set when non-root

    [ https://issues.apache.org/jira/browse/AMBARI-2542?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13697970#comment-13697970 ] 

Sumit Mohanty commented on AMBARI-2542:
---------------------------------------

Few minor comments:

+    ambariMetaInfo.refreshRepoBaseURL(metainfoDAO);
This is inside performStaticInjection(). However, ambariMetaInfo is initialized just before this method is called. We should move the statement close to ambariMetaInfo.init() - even group them out in an helper method.

{code}
+    if (null != ri.getDefaultBaseUrl() && newBaseUrl.equals(ri.getDefaultBaseUrl())) {
+      ri.setBaseUrl(newBaseUrl);
+      ri.setDefaultBaseUrl(null);
+      dao.remove(entity);
+    } else {
+      if (null == ri.getDefaultBaseUrl())
+        ri.setDefaultBaseUrl(ri.getBaseUrl());
+      ri.setBaseUrl(newBaseUrl);
+      dao.merge(entity);
+    }
{code}
Let me describe a scenario.
* Initially, ri.getDefaultBaseUrl() is not null and newBaseUrl.equals(ri.getDefaultBaseUrl()) is true (and there exists no entry in the metainfo)
** So the if-condition will be true and the code will setBaseUrl with the new value and set DefaultBaseUrl to null 
** It will remove the metaInfo
* On the following call we set the same url again as the newBaseUrl
** It will fall down to the else-conition and result will be DefaultBaseUrl and BaseUrl having the same value
** Also it will store the metainfo

It looks as if the same input produces two different behavior. Is that an issue? _unless my assumption about the initial condition is not correct_

Rest looks good.
                
> Custom Repo URL cannot be set when non-root
> -------------------------------------------
>
>                 Key: AMBARI-2542
>                 URL: https://issues.apache.org/jira/browse/AMBARI-2542
>             Project: Ambari
>          Issue Type: Bug
>          Components: controller
>    Affects Versions: 1.2.5
>            Reporter: Nate Cole
>            Assignee: Nate Cole
>             Fix For: 1.2.5
>
>         Attachments: AMBARI-2542.patch
>
>
> The first iteration for creating custom repo URL persisted the new URL to disk.  This poses a problem when running Ambari as non-root because the file system is owned by root.  Change the implementation to save the override in the metainfo table.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira