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

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

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)