Improved inputs documentation
- Added Computable Inputs to docs - Added small section about input manipulation (add/remove) Change-Id: I299af52abad347ed29a140f59adedb78f15485e6
This commit is contained in:
parent
875e91f1e5
commit
4c2859d3df
@ -93,6 +93,45 @@ all values are correct. ``!`` at the end of a type means that it is required
|
|||||||
* list with lists ``[[]]``
|
* list with lists ``[[]]``
|
||||||
|
|
||||||
|
|
||||||
|
Input manipulation
|
||||||
|
~~~~~~~~~~~~~~~~~~
|
||||||
|
There is possibility to add and remove inputs from given resource.
|
||||||
|
To do so you can use ``solar input add`` or ``solar input remove`` in Solar CLI.
|
||||||
|
|
||||||
|
|
||||||
|
Computable Inputs
|
||||||
|
-----------------
|
||||||
|
Computable input is special input type, it shares all logic that standard input has (connections etc),
|
||||||
|
but you can set a function that will return final input value.
|
||||||
|
|
||||||
|
.. note::
|
||||||
|
Remeber, that you need to connect inputs to have it accessible in Computable Inputs logic.
|
||||||
|
|
||||||
|
Currently you can write the functions using:
|
||||||
|
|
||||||
|
- Pure Python
|
||||||
|
- Jinja2 template
|
||||||
|
- LUA
|
||||||
|
|
||||||
|
Besides that there are 2 types of Computable Inputs:
|
||||||
|
|
||||||
|
- ``values``
|
||||||
|
|
||||||
|
- all connected inputs are passed by value as ``D`` variable
|
||||||
|
|
||||||
|
- ``full``
|
||||||
|
|
||||||
|
- all connected inputs are passed as array (python dict type) as ``R`` variable, so you have full information about input.
|
||||||
|
|
||||||
|
|
||||||
|
In addition for ``jinja`` all connected inputs for current resource are accessible as first level variables.
|
||||||
|
|
||||||
|
|
||||||
|
Change computable input
|
||||||
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
You can change Computable Input properties by calling ``solar input change_computable`` in Solar CLI.
|
||||||
|
|
||||||
|
|
||||||
Action
|
Action
|
||||||
------
|
------
|
||||||
Solar wraps deployment code into actions with specific names. Actions are
|
Solar wraps deployment code into actions with specific names. Actions are
|
||||||
|
@ -162,6 +162,7 @@ input:
|
|||||||
""")
|
""")
|
||||||
|
|
||||||
sample1 = self.create_resource('sample1', sample_meta_dir)
|
sample1 = self.create_resource('sample1', sample_meta_dir)
|
||||||
|
|
||||||
with self.assertRaises(Exception): # NOQA
|
with self.assertRaises(Exception): # NOQA
|
||||||
sample1.input_computable_change('value', '{{value}}')
|
sample1.input_computable_change('value', '{{value}}')
|
||||||
return sample1
|
return sample1
|
||||||
|
Loading…
Reference in New Issue
Block a user