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

Andrew Onischuk commented on AMBARI-22187:
------------------------------------------

Hi Pyush. I don't think we can run hdfs admin command as any user. Here's how I 
see this.
{noformat}

   hostname = params.hostname
-  safemode_check = format("su - {user} -c 'hdfs dfsadmin -safemode get'")
+  safemode_check = format("hdfs dfsadmin -safemode get")
 
   grep_pattern = format("Safe mode is {safemode_state} in {hostname}") if 
in_ha else format("Safe mode is {safemode_state}")
-  safemode_check_with_grep = format("su - {user} -c 'hdfs dfsadmin -safemode 
get | grep \"{grep_pattern}\"'")
+  safemode_check_with_grep = format("hdfs dfsadmin -safemode get | grep 
'{grep_pattern}'")
-  code, out = call(safemode_check)
+ code, out = call(safemode_check, user=params.hdfs_user)
{noformat}

(ps.  added one more line to changes)

> Non-root ambari user causes Express Upgrade to fail during checking HDFS safe 
> mode phase
> ----------------------------------------------------------------------------------------
>
>                 Key: AMBARI-22187
>                 URL: https://issues.apache.org/jira/browse/AMBARI-22187
>             Project: Ambari
>          Issue Type: Bug
>          Components: ambari-server
>    Affects Versions: 2.6.0
>            Reporter: Piyush Chavhan
>            Assignee: Piyush Chavhan
>             Fix For: 2.6.1
>
>         Attachments: AMBARI-22187-branch-2.6.0.patch, 
> AMBARI-22187-branch-2.6.0_updated.patch, BI_UPGRADE_ERROR.png
>
>
> If ambari-server and ambari-agents running using non-root user and tried to 
> upgrade from BigInsights stack 4.1 to 4.2.5. Perform Backups fails due to 
> "get safemode state" fails for NameNode as shown in attached screenshot 
> (BI_UPGRADE_ERROR).



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to