Commit Graph

35 Commits

Author SHA1 Message Date
David\ Beitey
9ad0ddc549 Allow parent relative includes in state files
This implements the solution to #25477.  Any ``include`` directives
within state files can use multiple dot notation (influenced by Python
relative imports) to refer to a parent state.

This also implements the same functionality inside the stateconf
renderer
(http://docs.saltstack.com/en/latest/ref/renderers/all/salt.renderers.stateconf.html),
which supported relative includes, excludes, and prefixed states.  This
PR expands on existing tests for stateconf.

This also updates the documentation accordingly.
2015-07-21 16:32:38 +10:00
Michael Steed
846e1a2378 py3: fix tests/unit/stateconf_test.py 2015-06-11 16:20:41 -06:00
Pedro Algarvio
fee4a62c87 Py3 compatibility fixes 2015-01-30 22:25:10 +00:00
Pedro Algarvio
60f215f191 Add from __future__ import absolute_import 2015-01-30 22:25:04 +00:00
Pedro Algarvio
f720fc1f78 Proper minion config initialization 2014-12-02 07:43:18 +00:00
Steve Weber
a0c3723c96 removed the slash when using slspath 2014-09-30 10:51:36 -06:00
Thomas S Hatch
444b203072 Pass the psudo funcs into the renderer 2013-12-12 21:47:42 -07:00
Thomas S Hatch
0f2a7974ae Fix syntax issue in stateconf test 2013-12-12 14:52:14 -07:00
Thomas S Hatch
0880c73c43 load in a fake config.get function to fix tests
Mocking may be a better way of doing this, but since these are
generated at the top of the test I felt that this solution was also viable
2013-12-12 11:50:53 -07:00
Pedro Algarvio
d02a2bc224 Include the python encoding file header on tests. 2013-11-27 11:19:24 +00:00
Pedro Algarvio
f25f0a41b2 Deprecate env usage in favor of saltenv. 2013-11-12 01:01:51 +00:00
Pedro Algarvio
8a938c9a66 Workaround the stateconf TypeError exceptions under python 2.6
```python
Traceback (most recent call last):
  File "/testing/tests/unit/stateconf_test.py", line 117, in test_state_prefix
    ''', sls='test')
  File "/testing/tests/unit/stateconf_test.py", line 30, in render_sls
    **kws.copy()
  File "/testing/salt/renderers/stateconf.py", line 229, in render
    data = process_sls_data(sls_templ, tmplctx)
  File "/testing/salt/renderers/stateconf.py", line 114, in process_sls_data
    argline=rt_argline.strip(), **kws
  File "/testing/salt/renderers/jinja.py", line 41, in render
    tmp_data.get('data', 'Unknown render error in jinja renderer')
SaltRenderError: Traceback (most recent call last):
  File "/testing/salt/utils/templates.py", line 64, in render_tmpl
    output = render_str(tmplstr, context, tmplpath)
  File "/testing/salt/utils/templates.py", line 102, in render_jinja_tmpl
    loader = JinjaSaltCacheLoader(opts, context['env'])
  File "/testing/salt/utils/jinja.py", line 42, in __init__
    self.searchpath = opts['file_roots'][env]
TypeError: list indices must be integers, not str
```
2013-08-12 13:55:03 +01:00
Pedro Algarvio
b03a5fcee3 Stop using the deprecated check_dns in salt.config.minion_config. 2013-07-20 01:38:09 +01:00
Pedro Algarvio
cb0922faf7 Updated some of the test cases to use a much more readable approach using salttesting.helpers.ensure_in_syspath(). 2013-06-28 00:12:59 +01:00
Pedro Algarvio
222be7b446 Make sure every test module is runnable by __main__.
* Double to single quotes
2013-06-28 00:12:56 +01:00
Chris Rebert
498d2999db more typo fixes 2013-05-01 16:52:52 -07:00
Chris Rebert
26209c1fc1 rm unused imports reported by pyflakes 2013-04-30 14:48:04 -07:00
Pedro Algarvio
5f58f0d28b We need OrderedDict support. So, as a last resort, provide our own.
* We try to import `OrderedDict` from the standard library, which is only available on python >= 2.7, if `ImportError` is raised we try to import it from `ordereddict`, a package available in PyPi. As a last resort, we provide our own implementation based on http://code.activestate.com/recipes/576669/.
* Update all code requiring `OrderDict` to use our compatible import module.
2013-04-23 12:56:23 +01:00
Jack Kuan
deee61c51a Fix a regression in the stateconf renderer and updated docs. 2013-03-01 09:35:45 -05:00
Jack Kuan
b7571dd891 Add support for #3483([pydsl] Import Python definitons from included files). 2013-02-01 12:32:19 -05:00
Pedro Algarvio
3629fe88c0 Fix tests.unit.pydsl_test and tests.unit.stateconf_test.
No more errors are shown because the configuration files are not readable, and in fact, the minion configuration can be use, unlike what was said in the comment.
2013-01-20 04:09:07 +00:00
Jack Kuan
a678901c48 Fix test cases for py2.6. 2013-01-18 14:14:42 -05:00
Jack Kuan
9c35844c56 Make pydsl work with stateconf.
- Added implicit ordering to pydsl.(turned on via __pydsl__.set(ordered=True))

- Fixed a KeyError bug in stateconf renderer that happens during id renaming.

- The stateconf renderer now generates a no-op start state as the
  "first" state in a sls file.(enabled via -s)

- Made the stateconf renderer take high state input via the new -p
  option, so we can pipe pydsl output into it.

- Added more and fixed some test cases for stateconf and pydsl.
2013-01-18 12:34:56 -05:00
Pedro Algarvio
d8d9d14d5a Fix the stateconf unit test. Refs #1775 2012-12-29 22:19:17 +00:00
Henrik Holmboe
5bcce96761 Update import in unit test.
https://travis-ci.org/holmboe/salt/jobs/3563157
2012-12-08 10:37:26 +01:00
Henrik Holmboe
a607016198 Update import in unit test.
https://travis-ci.org/holmboe/salt/jobs/3563086
2012-12-08 09:44:51 +01:00
Jack Kuan
190f4bd828 Fix a case when a single shorthand state is declared without arguments.
Also, now automatically adds the name argument, if one is not provided,
for states declared under a dot-prefixed state id.
2012-11-18 22:02:24 -05:00
Pedro Algarvio
bed55506c3 Proper OrderedDict check. 2012-11-17 01:19:37 +00:00
Pedro Algarvio
89fd313766 Fix stateconf test failing in 2.6 because OrderedDict was not available. 2012-11-16 22:45:12 +00:00
Jack Kuan
7f3ac3fe89 Add some docs on render pipe.
Also, added a stateconf state so that its stateconf.set function
can be used by the stateconf renderer.
2012-11-13 02:01:34 -05:00
Thomas S Hatch
6fce0a2353 Minor fixes for stateconf tests and sting updates 2012-11-12 22:20:37 -07:00
Jack Kuan
7ad98acfb4 Fix stateconf unit test and the problem with sls_dir==''. 2012-11-12 00:50:46 -05:00
Jack Kuan
8cb70d0a6e Update stateconf renderer module doc and revert names declaration support. 2012-11-12 00:16:03 -05:00
Jack Kuan
f1c49d6efd Minor update to a test case. 2012-11-08 02:00:54 -05:00
Jack Kuan
f921e91377 Add unit tests for the stateconf renderer.
Also fixed a few bugs in the stateconf renderer.
2012-11-08 01:46:03 -05:00