Github user cestella commented on a diff in the pull request:

    https://github.com/apache/metron/pull/673#discussion_r129865954
  
    --- Diff: metron-deployment/packaging/ambari/README.md ---
    @@ -0,0 +1,86 @@
    +# Ambari Management Pack Development
    +Typically, Ambari Management Pack development will be done in the Vagrant 
environments. These instructions are specific to Vagrant, but can be adapted 
for other environemnts (e.g. make sure to be on the correct nodes for server vs 
agent files)
    +
    +
    +# Adding a new property
    +1. Add the property to the appropriate `*-env.xml` file found in 
`METRON.CURRENT/configuration`.
    +  ```
    +    <property>
    +        <name>new_property</name>
    +        <description>New Property description</description>
    +        <value>Default Value</value>
    +        <display-name>New Property Pretty Name</display-name>
    +    </property>
    +  ```
    +
    +2.  Reference the property in 
`METRON.CURRENT/package/scriptes/params/params_linux.py`, unless it will be 
used in Ambari's status command.  It will be stored in a variable. The name 
doesn't have to match, but it's preferred that it does.
    +Make sure to use replace `metron-env` the correct `*-env` file, as noted 
above.
    +  ```
    +  new_property = config['configurations']['metron-env']['new_property']
    +  ```
    +If this property will be used in the status command, instead make this 
change in `METRON.CURRENT/package/scriptes/params/status_params.py`.
    +Afterwards, in `params_linux.py`, reference the new property:
    +  ```
    +  new_property = status_params.new_property
    +  ```
    +This behavior is because Ambari doesn't send all parameters to the status, 
so it needs to be explicitly provided.
    +
    +3. Ambari master services can then import the params as such
    +
    +  ```
    +  from params import params
    +  env.set_params(params)
    +  ```
    +
    +4. The `*_commands.py` files receive the params as an input from the 
master services.  Once this is done, they can be accessed via the variable we 
set above:
    +  ```
    +  self.__params.new_property
    +  ```
    +
    +  Ambari also has a custom `format` function that can access properties 
when producing strings as output:
    --- End diff --
    
    What about referencing properties in the `.j2` files?  you talk about 
adding a new property, but how do we actually hook in the value into the config?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to