You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ambari.apache.org by "Dmitry Lysnichenko (JIRA)" <ji...@apache.org> on 2013/11/01 16:23:17 UTC

[jira] [Commented] (AMBARI-3663) Resource Management. Easy formatting of configurations

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

Dmitry Lysnichenko commented on AMBARI-3663:
--------------------------------------------

+1

> Resource Management. Easy formatting of configurations
> ------------------------------------------------------
>
>                 Key: AMBARI-3663
>                 URL: https://issues.apache.org/jira/browse/AMBARI-3663
>             Project: Ambari
>          Issue Type: Bug
>            Reporter: Andrew Onischuk
>            Assignee: Andrew Onischuk
>             Fix For: 1.5.0
>
>         Attachments: AMBARI-3663.patch
>
>
> Since our previous code used a lot of substition, it would good to help to subtitute configurations, and variables
> {code}
> kinit_if_needed = "su - {user} -c '{kinit_path_local} -kt {keytab} {principal}'".format(
>             user=self.resource.user, kinit_path_local=self.resource.kinit_path_local, 
>             keytab=self.resource.keytab, principal=self.resource.principal)
> {code}
> =>
> {code}
> kinit_if_needed = format("su - {user} -c '{kinit_path_local} -kt {keytab} {principal}'")
> {code}
> Which is seems to be more readable, and less error prone
> If there are variable and configuration with the same name found, early exception is thrown, so such an user errors no longer danger
> Also path includes minor changes:
> - removed $ substitution
> - allowing passing additional args to template
> Template('name.txt.j2',arg='value', ...)
> - throw exception in case when variable in template not found
> - refactored HadoopExecute



--
This message was sent by Atlassian JIRA
(v6.1#6144)