incubator-ambari-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Andrew Onischuk (JIRA)" <j...@apache.org>
Subject [jira] [Created] (AMBARI-3663) Resource Management. Easy formatting of configurations
Date Fri, 01 Nov 2013 14:03:20 GMT
Andrew Onischuk created AMBARI-3663:
---------------------------------------

             Summary: 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


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)

Mime
View raw message