Commit Graph

93 Commits

Author SHA1 Message Date
Erik Johnson
002aa88a97
Replace yaml usage with a helper to ensure unicode is handled properly
Without allow_unicode=True, unicode characters are processed through the
str representer and on Python 2 are dumped as a Unicode code point (i.e.
a literal \u0414). This commit makes allow_unicode=True the default in
our salt.utils.yamlloader.safe_dump() helper. It also adds a new
salt.utils.yamlloader.dump() helper which wraps yaml.dump() and also
makes allow_unicode=True the default.

To make importing and using our custom yaml loader/dumper easier, a
convenience module called salt.utils.yaml has been added, which does a
wildcard import from both salt.utils.yamldumper and
salt.utils.yamlloader.

Refs to yaml.load/dump and yaml.safe_load/safe_dump have been updated to
salt.utils.yaml, to ensure that unicode is handled properly.
2018-01-03 14:14:21 -06:00
Erik Johnson
3184168365 Use explicit unicode strings + break up salt.utils
This PR is part of what will be an ongoing effort to use explicit
unicode strings in Salt. Because Python 3 does not suport Python 2's raw
unicode string syntax (i.e. `ur'\d+'`), we must use
`salt.utils.locales.sdecode()` to ensure that the raw string is unicode.
However, because of how `salt/utils/__init__.py` has evolved into the
hulking monstrosity it is today, this means importing a large module in
places where it is not needed, which could negatively impact
performance. For this reason, this PR also breaks out some of the
functions from `salt/utils/__init__.py` into new/existing modules under
`salt/utils/`. The long term goal will be that the modules within this
directory do not depend on importing `salt.utils`.

A summary of the changes in this PR is as follows:

* Moves the following functions from `salt.utils` to new locations
  (including a deprecation warning if invoked from `salt.utils`):
  `to_bytes`, `to_str`, `to_unicode`, `str_to_num`, `is_quoted`,
  `dequote`, `is_hex`, `is_bin_str`, `rand_string`,
  `contains_whitespace`, `clean_kwargs`, `invalid_kwargs`, `which`,
  `which_bin`, `path_join`, `shlex_split`, `rand_str`, `is_windows`,
  `is_proxy`, `is_linux`, `is_darwin`, `is_sunos`, `is_smartos`,
  `is_smartos_globalzone`, `is_smartos_zone`, `is_freebsd`, `is_netbsd`,
  `is_openbsd`, `is_aix`
* Moves the functions already deprecated by @rallytime to the bottom of
  `salt/utils/__init__.py` for better organization, so we can keep the
  deprecated ones separate from the ones yet to be deprecated as we
  continue to break up `salt.utils`
* Updates `salt/*.py` and all files under `salt/client/` to use explicit
  unicode string literals.
* Gets rid of implicit imports of `salt.utils` (e.g. `from salt.utils
  import foo` becomes `import salt.utils.foo as foo`).
* Renames the `test.rand_str` function to `test.random_hash` to more
  accurately reflect what it does
* Modifies `salt.utils.stringutils.random()` (née `salt.utils.rand_string()`)
  such that it returns a string matching the passed size. Previously
  this function would get `size` bytes from `os.urandom()`,
  base64-encode it, and return the result, which would in most cases not
  be equal to the passed size.
2017-08-08 13:33:43 -05:00
rallytime
a69cd74f75 Merge branch '2016.11' into 'nitrogen'
Conflicts:
  - salt/cloud/clouds/nova.py
  - salt/spm/__init__.py
2017-04-28 09:23:42 -06:00
rallytime
62c4d37c2f Use salt.utils.yamlloader with SaltYamlSafeLoader as the Loader with yaml.load 2017-04-18 13:41:07 -06:00
rallytime
d398c5f7ee Update autodoc topics for new modules added in develop
Also adjusted versionadded tags as necessary on the files that
are getting new autodoc files added.
2017-02-02 10:12:58 -07:00
Eric Radman
3f2e13d1fc Remove repeated words in docs (#37871)
Found using

find . -name '*.rst' | xargs igor -R -r
2016-11-23 14:53:17 -07:00
rallytime
9d049e28e5 Merge branch '2016.3' into 'develop'
Conflicts:
  - salt/modules/win_pkg.py
  - salt/states/disk.py
2016-06-15 17:13:26 -06:00
Jacob Hammons
887a415138 Adds new Understanding Jinja topic, and fixes several Jinja doc issues.
Removes the "Full list of builtin ..." from each module reference list, leaving just the module type for scanability.

Refs #12470
Refs #10206
Refs #10480
Refs #23522
Refs #33023
2016-06-13 18:30:42 -06:00
Erik Johnson
0af498c5a7 Add dson renderer from SaltConf 16 presentation (#32894) 2016-04-27 11:19:22 -06:00
rallytime
cbf42a8407 Merge branch '2016.3' into 'develop'
Conflicts:
  - conf/master
  - doc/ref/configuration/master.rst
  - salt/cli/batch.py
  - salt/cli/daemons.py
  - salt/config/__init__.py
  - salt/minion.py
  - salt/modules/aptpkg.py
  - salt/modules/beacons.py
  - salt/states/archive.py
  - salt/states/cmd.py
  - salt/utils/gitfs.py
  - tests/unit/states/cmd_test.py
2016-04-26 14:42:26 -06:00
Erik Johnson
aa9c458346 Add json5 renderer (#32635)
* Add JSON5 renderer

* Add documentation RST files for json5 renderer
2016-04-16 12:37:42 -06:00
rallytime
d684d49490 Merge branch '2016.3' into 'develop'
Conflicts:
  - doc/topics/releases/2015.5.10.rst
  - doc/topics/releases/2015.8.8.rst
2016-03-28 11:16:22 -06:00
rallytime
7554d0f42d Merge branch '2015.5' into '2015.8'
Conflicts:
  - doc/ref/states/include.rst
  - doc/topics/cloud/reactor.rst
  - doc/topics/reactor/index.rst
  - doc/topics/releases/2015.5.10.rst
  - doc/topics/tutorials/states_pt5.rst
  - doc/topics/windows/windows-package-manager.rst
  - salt/config.py
  - salt/modules/state.py
  - salt/states/grains.py
  - tests/integration/modules/sysmod.py
  - tests/unit/states/grains_test.py
2016-03-24 15:48:00 -06:00
Erik Johnson
1b97e4a3df Improve state module docs, replace references to state.highstate/state.sls with state.apply
Resolves #32037.
2016-03-21 22:56:17 -05:00
Justin Findlay
4953f7b0df doc/ref/renderers/index.rst: remove env support 2016-02-16 19:26:57 -07:00
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
Seth House
57b1f67daa Added autosummary generated placeholders for the new module docs 2015-03-02 14:07:18 -07:00
Seth House
1382401618 Updated all the module index pages with the latest/newest modules 2015-03-02 13:59:19 -07:00
Arnold Bechtoldt
2ad37d0bca adding renderers to doc salt.renderers reference 2015-01-24 22:41:54 +01:00
Thomas Jackson
85864eca4a Comma cleanup 2014-12-12 11:37:59 -08:00
Thomas Jackson
7da2bbc457 fix usage of e.g (no comma) 2014-12-12 11:37:48 -08:00
Thomas Jackson
9db7f8f7e9 Whitespace cleanup 2014-12-11 07:53:19 -08:00
Thomas Jackson
3859204103 Fix typo in renderers doc, the directory name was wrong 2014-12-10 18:42:16 -08:00
Jakob Gillich
0112f70d9c remove example duplicate 2014-08-22 16:06:09 +02:00
Seth House
6517e7f378 Added generated new module docs 2014-07-24 15:56:19 -06:00
Seth House
81af51bf50 Added new module docs 2014-07-24 15:28:11 -06:00
Khris Richardson
1acd82f3f1 add sphinx spelling extension. enforce en_us 2014-07-13 13:43:33 -05:00
Erik Johnson
2849950bce Docs cleanup
Fixes double-colons by making them code-block directives, so they do not
erroneously show up as "PYTHON" blocks. Also corrects a few instances of
2nd person pronoun usage.
2014-07-13 11:02:33 -05:00
Thomas S Hatch
b8897a5b0d rename the sls renderer to the yamlex renderer 2014-05-30 09:28:20 -06:00
Thomas S Hatch
185eae31cd Merge branch 'serializers-migration' of https://github.com/johnnoone/salt into johnnoone-serializers-migration
Conflicts:
	salt/pillar/__init__.py
2014-05-30 09:16:21 -06:00
Seth House
1610bda84b Pulled Jinja docs back into the code
We were accumulating two versions of the docs since people update
docstrings as they hack but only one was getting rendered on the site.

Hopefully this is a happy middle-ground by spreading the docs around a
bit and pulling them in to a central location.
2014-04-17 14:24:15 -06:00
Seth House
14515c3c8b Added generated templates for the new additions 2014-04-17 12:20:07 -06:00
Seth House
d2f057b0fd Combed through all the module types to add recent additions to the docs 2014-04-17 12:16:26 -06:00
Xavier Barbosa
ce2cf98518 implements sls renderer 2014-04-09 06:45:10 +02:00
Thomas Güttler
7d25e086d3 "Full List of Renderes" was a sub section of "Examples" before. 2014-04-07 09:27:21 +02:00
Seth House
12481b9e38 Added ref anchor for renderer docs 2014-02-27 19:38:57 -07:00
Mike Place
826bad4cfb Merge conflict and rebase.
Conflicts:
	doc/ref/renderers/index.rst
2014-02-26 13:32:08 -07:00
Henrik Holmboe
de1548aeb0 Missing comma 2014-02-24 14:21:57 +01:00
Henrik Holmboe
09321799bf Add automodule and autosummary doc for the pyobjects renderer 2014-02-24 14:21:02 +01:00
Mike Place
a485eceac9 Fix all broken links in docs. Ignore certain known-good links. Adjust many links that are returning 301.
Conflicts:
	doc/topics/installation/index.rst
2014-02-20 16:16:59 -07:00
Mike Place
e32b0077d8 Moved YAML documentation into renderer page.
Conflicts:
	doc/topics/yaml/index.rst
2014-02-20 10:15:50 -07:00
Mike Place
6186eeab68 Renderer index re-write for clarity. 2014-02-19 13:55:34 -07:00
Thomas S Hatch
a7baf5936c Revert "add sequence filter for jinja"
This reverts commit cbe04b8231.
2014-02-11 15:59:22 -07:00
Xavier Barbosa
cbe04b8231 add sequence filter for jinja 2014-02-11 20:42:40 +01:00
Seth House
cd1df50d25 Added `python` Jinja filter to jinja renderer docs 2014-01-23 19:41:16 -07:00
Sergey
2da8e454e7 fix grammar in salt.renderers.jinja.rst 2013-11-05 18:28:21 +02:00
Joe Healy
aece0976a6 Fixed pedantic spelling errors picked up by lintian
joe@unstable-builder:~/salt_017rc/salt$ lintian -I ../*.deb
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz softwares software - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz specifed specified - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz Targetting Targeting - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz targetted targeted - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz Dependant Dependent - done
I: salt-common: FSSTND-dir-in-manual-page usr/share/man/man7/salt.7.gz:57301 /var/named/ - not done - example
I: salt-common: FSSTND-dir-in-manual-page usr/share/man/man7/salt.7.gz:57320 /var/named/ - not done - example
I: salt-common: FSSTND-dir-in-manual-page usr/share/man/man7/salt.7.gz:57339 /var/named/ - not done - example
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz recieve receive - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz allows to allows one to - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz allows to allows one to - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz dont don't - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz succesfully successfully - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz softwares software - done
I: salt-common: spelling-error-in-manpage usr/share/man/man7/salt.7.gz These package This package - not done - legitimate
2013-09-20 22:01:20 +10:00
Erik Johnson
c490a73517 pkg, not package 2013-08-01 13:01:49 -05:00
Xavier Barbosa
45677a9875 added doc 2013-07-26 09:30:41 +02:00
Pedro Algarvio
1ff844dfb6 Link to the datetime python documentation. 2013-07-23 18:03:42 +01:00