From 51fa87c446477dd040b7b8400408bd4898a34239 Mon Sep 17 00:00:00 2001 From: Seth House Date: Fri, 12 Dec 2014 23:29:48 -0700 Subject: [PATCH] Change all state examples to use short-dec format for consistency Closes #12419. The command used to search the docs for state examples is below. This generates a file in Vim's quickfix format that can be loaded with the -q flag. find . -type f \( -name '*.rst' -o -name '*.py' \) -print0 | xargs -0 -P10 -n1 awk ' BEGIN { RS=""; FS="\n" } { linenr = linect; linect += (NF + 1) } /^\s+[a-zA-Z0-9'\''_-]+:\n\s+[a-zA-Z0-9'\''_-]+:\n\s+- / { print FILENAME "|" linenr + 2 "|", $1 } ' > ./salt-states.quickfix --- doc/faq.rst | 16 ++---- doc/ref/states/compiler_ordering.rst | 57 +++++++++++-------- doc/ref/states/highstate.rst | 19 +++---- doc/ref/states/index.rst | 36 ++++++------ doc/ref/states/ordering.rst | 18 ++---- doc/ref/states/requisites.rst | 32 ++++------- doc/topics/best_practices.rst | 54 ++++++------------ .../development/conventions/formulas.rst | 24 +++----- doc/topics/installation/ubuntu.rst | 9 ++- doc/topics/mine/index.rst | 3 +- doc/topics/pillar/index.rst | 6 +- doc/topics/tutorials/cloud_controller.rst | 18 ++---- doc/topics/tutorials/pillar.rst | 6 +- doc/topics/tutorials/starting_states.rst | 18 ++---- doc/topics/tutorials/states_pt2.rst | 21 +++---- doc/topics/tutorials/states_pt3.rst | 3 +- doc/topics/tutorials/walkthrough.rst | 8 +-- salt/client/ssh/wrapper/grains.py | 6 +- salt/modules/daemontools.py | 3 +- salt/modules/grains.py | 6 +- salt/states/archive.py | 6 +- salt/states/blockdev.py | 3 +- salt/states/cmd.py | 9 +-- salt/states/glusterfs.py | 3 +- salt/states/npm.py | 6 +- salt/states/pkgng.py | 3 +- salt/states/powerpath.py | 3 +- salt/states/rabbitmq_plugin.py | 3 +- salt/states/rvm.py | 9 ++- salt/states/service.py | 9 +-- salt/states/ssh_auth.py | 12 ++-- salt/states/supervisord.py | 3 +- salt/states/tomcat.py | 9 +-- salt/states/win_system.py | 6 +- 34 files changed, 173 insertions(+), 274 deletions(-) diff --git a/doc/faq.rst b/doc/faq.rst index ad6f982ade..fa6ccb862d 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -203,8 +203,7 @@ Linux/Unix .. code-block:: yaml salt-minion-reload: - cmd: - - run + cmd.run: - name: echo service salt-minion restart | at now + 1 minute - order: last @@ -215,10 +214,9 @@ distro the minion is running, in case they differ from the example below. .. code-block:: yaml at: - pkg: - - installed - service: - - running + pkg.installed: + - name: at + service.running: - name: atd - enable: True @@ -240,13 +238,11 @@ Windows .. code-block:: yaml schedule-start: - cmd: - - run + cmd.run: - name: at (Get-Date).AddMinutes(1).ToString("HH:mm") cmd /c "net start salt-minion" - shell: powershell - order: last - service: - - dead + service.dead: - name: salt-minion - require: - cmd: schedule-start diff --git a/doc/ref/states/compiler_ordering.rst b/doc/ref/states/compiler_ordering.rst index a11e00511d..01fbfea640 100644 --- a/doc/ref/states/compiler_ordering.rst +++ b/doc/ref/states/compiler_ordering.rst @@ -57,16 +57,17 @@ As an example, a state written thusly: .. code-block:: yaml apache: - pkg: - - installed - service: - - running + pkg.installed: + - name: httpd + service.running: + - name: httpd - watch: - - file: /etc/httpd/conf.d/httpd.conf + - file: apache_conf - pkg: apache - /etc/httpd/conf.d/httpd.conf: - file: - - managed + + apache_conf: + file.managed: + - name: /etc/httpd/conf.d/httpd.conf - source: salt://apache/httpd.conf Will have High Data which looks like this represented in json: @@ -76,41 +77,50 @@ Will have High Data which looks like this represented in json: { "apache": { "pkg": [ + { + "name": "httpd" + }, "installed", { "order": 10000 } ], "service": [ - "running", + { + "name": "httpd" + }, { "watch": [ { - "file": "/etc/httpd/conf.d/httpd.conf" + "file": "apache_conf" }, { "pkg": "apache" } ] }, + "running", { "order": 10001 } ], - "__sls__": "apache", + "__sls__": "blah", "__env__": "base" }, - "/etc/httpd/conf.d/httpd.conf": { + "apache_conf": { "file": [ - "managed", + { + "name": "/etc/httpd/conf.d/httpd.conf" + }, { "source": "salt://apache/httpd.conf" }, + "managed", { "order": 10002 } ], - "__sls__": "apache", + "__sls__": "blah", "__env__": "base" } } @@ -121,19 +131,19 @@ The subsequent Low Data will look like this: [ { - "name": "apache", + "name": "httpd", "state": "pkg", "__id__": "apache", "fun": "installed", "__env__": "base", - "__sls__": "apache", + "__sls__": "blah", "order": 10000 }, { - "name": "apache", + "name": "httpd", "watch": [ { - "file": "/etc/httpd/conf.d/httpd.conf" + "file": "apache_conf" }, { "pkg": "apache" @@ -143,22 +153,21 @@ The subsequent Low Data will look like this: "__id__": "apache", "fun": "running", "__env__": "base", - "__sls__": "apache", + "__sls__": "blah", "order": 10001 }, { "name": "/etc/httpd/conf.d/httpd.conf", "source": "salt://apache/httpd.conf", "state": "file", - "__id__": "/etc/httpd/conf.d/httpd.conf", + "__id__": "apache_conf", "fun": "managed", "__env__": "base", - "__sls__": "apache", + "__sls__": "blah", "order": 10002 } ] - This tutorial discusses the Low Data evaluation and the state runtime. Ordering Layers @@ -235,8 +244,8 @@ ordering can be explicitly overridden using the `order` flag in states: .. code-block:: yaml apache: - pkg: - - installed + pkg.installed: + - name: httpd - order: 1 This order flag will over ride the definition order, this makes it very diff --git a/doc/ref/states/highstate.rst b/doc/ref/states/highstate.rst index 4fbb557147..3617f0010d 100644 --- a/doc/ref/states/highstate.rst +++ b/doc/ref/states/highstate.rst @@ -103,8 +103,8 @@ declaration that will restart Apache whenever the Apache configuration file, - file: mywebsite mywebsite: - file: - - managed + file.managed: + - name: /var/www/mysite .. seealso:: watch_in and require_in @@ -168,10 +168,10 @@ For example, the following state declaration calls the :mod:`installed .. code-block:: yaml httpd: - pkg.installed + pkg.installed: [] -The function can be declared inline with the state as a shortcut, but -the actual data structure is better referenced in this form: +The function can be declared inline with the state as a shortcut. +The actual data structure is compiled to this form: .. code-block:: yaml @@ -203,10 +203,8 @@ VALID: .. code-block:: yaml httpd: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: [] Occurs as the only index in the :ref:`state-declaration` list. @@ -280,8 +278,7 @@ easier to specify ``mywebsite`` than to specify - file: mywebsite apache2: - service: - - running + service.running: - watch: - file: mywebsite diff --git a/doc/ref/states/index.rst b/doc/ref/states/index.rst index 6ebadcc6c9..e637123600 100644 --- a/doc/ref/states/index.rst +++ b/doc/ref/states/index.rst @@ -113,19 +113,17 @@ Here is an example of a Salt State: .. code-block:: yaml vim: - pkg: - - installed + pkg.installed: [] salt: - pkg: - - latest + pkg.latest: + - name: salt service.running: - - require: - - file: /etc/salt/minion - - pkg: salt - names: - salt-master - salt-minion + - require: + - pkg: salt - watch: - file: /etc/salt/minion @@ -196,15 +194,15 @@ the following state file which we'll call ``pep8.sls``: .. code-block:: yaml python-pip: - cmd: - - run + cmd.run: + - name: | + easy_install --script-dir=/usr/bin -U pip - cwd: / - - name: easy_install --script-dir=/usr/bin -U pip pep8: - pip.installed - requires: - - cmd: python-pip + pip.installed: + - require: + - cmd: python-pip The above example installs `pip`_ using ``easy_install`` from `setuptools`_ and @@ -276,16 +274,16 @@ The modified state file would now be: .. code-block:: yaml python-pip: - cmd: - - run + cmd.run: + - name: | + easy_install --script-dir=/usr/bin -U pip - cwd: / - - name: easy_install --script-dir=/usr/bin -U pip - reload_modules: true pep8: - pip.installed - requires: - - cmd: python-pip + pip.installed: + - require: + - cmd: python-pip Let's run it, once: diff --git a/doc/ref/states/ordering.rst b/doc/ref/states/ordering.rst index c6c5edf20f..bca5cd05a0 100644 --- a/doc/ref/states/ordering.rst +++ b/doc/ref/states/ordering.rst @@ -61,8 +61,7 @@ These requisite statements are applied to a specific state declaration: .. code-block:: yaml httpd: - pkg: - - installed + pkg.installed: [] file.managed: - name: /etc/httpd/conf/httpd.conf - source: salt://httpd/httpd.conf @@ -91,10 +90,8 @@ the discrete states are split or groups into separate sls files: - network httpd: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - require: - pkg: httpd - sls: network @@ -121,8 +118,7 @@ more requisites. Both requisite types can also be separately declared: .. code-block:: yaml httpd: - pkg: - - installed + pkg.installed: [] service.running: - enable: True - watch: @@ -136,10 +132,8 @@ more requisites. Both requisite types can also be separately declared: - source: salt://httpd/httpd.conf - require: - pkg: httpd - user: - - present - group: - - present + user.present: [] + group.present: [] In this example, the httpd service is only going to be started if the package, user, group and file are executed successfully. diff --git a/doc/ref/states/requisites.rst b/doc/ref/states/requisites.rst index e2e86c1aab..8f0ee870e7 100644 --- a/doc/ref/states/requisites.rst +++ b/doc/ref/states/requisites.rst @@ -20,7 +20,7 @@ the targeting state. The following example demonstrates a direct requisite: .. code-block:: yaml vim: - pkg.installed + pkg.installed: [] /etc/vimrc: file.managed: @@ -258,15 +258,13 @@ The ``onfail`` requisite is applied in the same way as ``require`` as ``watch``: .. code-block:: yaml primary_mount: - mount: - - mounted + mount.mounted: - name: /mnt/share - device: 10.0.0.45:/share - fstype: nfs backup_mount: - mount: - - mounted + mount.mounted: - name: /mnt/share - device: 192.168.40.34:/share - fstype: nfs @@ -338,10 +336,8 @@ Using ``require`` .. code-block:: yaml httpd: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - require: - pkg: httpd @@ -350,12 +346,10 @@ Using ``require_in`` .. code-block:: yaml httpd: - pkg: - - installed + pkg.installed: - require_in: - service: httpd - service: - - running + service.running: [] The ``require_in`` statement is particularly useful when assigning a require in a separate sls file. For instance it may be common for httpd to require @@ -367,10 +361,8 @@ http.sls .. code-block:: yaml httpd: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - require: - pkg: httpd @@ -382,8 +374,7 @@ php.sls - http php: - pkg: - - installed + pkg.installed: - require_in: - service: httpd @@ -395,8 +386,7 @@ mod_python.sls - http mod_python: - pkg: - - installed + pkg.installed: - require_in: - service: httpd diff --git a/doc/topics/best_practices.rst b/doc/topics/best_practices.rst index a38f3185d6..d6f17dd598 100644 --- a/doc/topics/best_practices.rst +++ b/doc/topics/best_practices.rst @@ -192,8 +192,7 @@ preferred: - apache apache_conf: - file: - - managed + file.managed: - name: {{ name }} - source: {{ tmpl }} - template: jinja @@ -224,8 +223,7 @@ locations within a single state: - apache apache_conf: - file: - - managed + file.managed: - name: {{ salt['pillar.get']('apache:lookup:name') }} - source: {{ salt['pillar.get']('apache:lookup:config:tmpl') }} - template: jinja @@ -250,15 +248,12 @@ is not very modular to one that is: .. code-block:: yaml httpd: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - enable: True /etc/httpd/httpd.conf: - file: - - managed + file.managed: - source: salt://apache/files/httpd.conf - template: jinja - watch_in: @@ -286,17 +281,14 @@ opposed to direct ID references: .. code-block:: yaml apache: - pkg: - - installed + pkg.installed: - name: httpd - service: + service.running: - name: httpd - enable: True - - running apache_conf: - file: - - managed + file.managed: - name: /etc/httpd/httpd.conf - source: salt://apache/files/httpd.conf - template: jinja @@ -351,17 +343,14 @@ modification of static values: {% from "apache/map.jinja" import apache with context %} apache: - pkg: - - installed + pkg.installed: - name: {{ apache.server }} - service: + service.running: - name: {{ apache.service }} - enable: True - - running apache_conf: - file: - - managed + file.managed: - name: {{ apache.conf }} - source: {{ salt['pillar.get']('apache:lookup:config:tmpl') }} - template: jinja @@ -411,13 +400,11 @@ to be broken into two states. {% from "apache/map.jinja" import apache with context %} apache: - pkg: - - installed + pkg.installed: - name: {{ apache.server }} - service: + service.running: - name: {{ apache.service }} - enable: True - - running ``/srv/salt/apache/conf.sls``: @@ -429,8 +416,7 @@ to be broken into two states. - apache apache_conf: - file: - - managed + file.managed: - name: {{ apache.conf }} - source: {{ salt['pillar.get']('apache:lookup:config:tmpl') }} - template: jinja @@ -463,8 +449,7 @@ accessible by the appropriate hosts: .. code-block:: yaml testdb: - mysql_database: - - present: + mysql_database.present:: - name: testerdb ``/srv/salt/mysql/user.sls``: @@ -475,8 +460,7 @@ accessible by the appropriate hosts: - mysql.testerdb testdb_user: - mysql_user: - - present + mysql_user.present: - name: frank - password: "test3rdb" - host: localhost @@ -521,8 +505,7 @@ the associated pillar: .. code-block:: yaml testdb: - mysql_database: - - present: + mysql_database.present: - name: {{ salt['pillar.get']('mysql:lookup:name') }} ``/srv/salt/mysql/user.sls``: @@ -533,8 +516,7 @@ the associated pillar: - mysql.testerdb testdb_user: - mysql_user: - - present + mysql_user.present: - name: {{ salt['pillar.get']('mysql:lookup:user') }} - password: {{ salt['pillar.get']('mysql:lookup:password') }} - host: {{ salt['pillar.get']('mysql:lookup:host') }} diff --git a/doc/topics/development/conventions/formulas.rst b/doc/topics/development/conventions/formulas.rst index 68c85fdb69..99caa59f31 100644 --- a/doc/topics/development/conventions/formulas.rst +++ b/doc/topics/development/conventions/formulas.rst @@ -116,8 +116,7 @@ package until after the EPEL repository has also been installed: - epel python26: - pkg: - - installed + pkg.installed: - require: - pkg: epel @@ -767,11 +766,9 @@ state file using the following syntax: {% from "mysql/map.jinja" import mysql with context %} mysql-server: - pkg: - - installed + pkg.installed: - name: {{ mysql.server }} - service: - - running + service.running: - name: {{ mysql.service }} Overriding values in the lookup table @@ -973,11 +970,9 @@ skips platform-specific options for brevity. See the full # apache/init.sls apache: - pkg: - - installed + pkg.installed: [...] - service: - - running + service.running: [...] # apache/mod_wsgi.sls @@ -985,8 +980,7 @@ skips platform-specific options for brevity. See the full - apache mod_wsgi: - pkg: - - installed + pkg.installed: [...] - require: - pkg: apache @@ -996,8 +990,7 @@ skips platform-specific options for brevity. See the full - apache apache_conf: - file: - - managed + file.managed: [...] - watch_in: - service: apache @@ -1088,8 +1081,7 @@ thousands of function calls across a large state tree. {% set settings = salt['pillar.get']('apache', {}) %} mod_status: - file: - - managed + file.managed: - name: {{ apache.conf_dir }} - source: {{ settings.get('mod_status_conf', 'salt://apache/mod_status.conf') }} - template: {{ settings.get('template_engine', 'jinja') }} diff --git a/doc/topics/installation/ubuntu.rst b/doc/topics/installation/ubuntu.rst index 2ba21354ac..1aa1a8853d 100644 --- a/doc/topics/installation/ubuntu.rst +++ b/doc/topics/installation/ubuntu.rst @@ -85,15 +85,14 @@ the minion: .. code-block:: yaml update_zmq: - pkg: - - latest + pkg.latest: - pkgs: - zeromq - python-zmq - order: last - cmd: - - wait - - name: echo service salt-minion restart | at now + 1 minute + cmd.wait: + - name: | + echo service salt-minion restart | at now + 1 minute - watch: - pkg: update_zmq diff --git a/doc/topics/mine/index.rst b/doc/topics/mine/index.rst index ebf68a3288..4dc0d544af 100644 --- a/doc/topics/mine/index.rst +++ b/doc/topics/mine/index.rst @@ -96,8 +96,7 @@ to add them to the pool of load balanced servers. .. code-block:: yaml haproxy_config: - file: - - managed + file.managed: - name: /etc/haproxy/config - source: salt://haproxy_config - template: jinja diff --git a/doc/topics/pillar/index.rst b/doc/topics/pillar/index.rst index 5cd78db447..1bbd324975 100644 --- a/doc/topics/pillar/index.rst +++ b/doc/topics/pillar/index.rst @@ -96,15 +96,13 @@ more via the shared pillar :ref:`dict `: .. code-block:: yaml apache: - pkg: - - installed + pkg.installed: - name: {{ pillar['apache'] }} .. code-block:: yaml git: - pkg: - - installed + pkg.installed: - name: {{ pillar['git'] }} Finally, the above states can utilize the values provided to them via Pillar. diff --git a/doc/topics/tutorials/cloud_controller.rst b/doc/topics/tutorials/cloud_controller.rst index f50b6155ad..cdff7e7114 100644 --- a/doc/topics/tutorials/cloud_controller.rst +++ b/doc/topics/tutorials/cloud_controller.rst @@ -53,20 +53,16 @@ to set up the libvirt pki keys. .. code-block:: yaml libvirt: - pkg: - - installed - file: - - managed + pkg.installed: [] + file.managed: - name: /etc/sysconfig/libvirtd - contents: 'LIBVIRTD_ARGS="--listen"' - require: - pkg: libvirt - libvirt: - - keys + libvirt.keys: - require: - pkg: libvirt - service: - - running + service.running: - name: libvirtd - require: - pkg: libvirt @@ -76,12 +72,10 @@ to set up the libvirt pki keys. - file: libvirt libvirt-python: - pkg: - - installed + pkg.installed: [] libguestfs: - pkg: - - installed + pkg.installed: - pkgs: - libguestfs - libguestfs-tools diff --git a/doc/topics/tutorials/pillar.rst b/doc/topics/tutorials/pillar.rst index 5e0080da45..7dc17914e5 100644 --- a/doc/topics/tutorials/pillar.rst +++ b/doc/topics/tutorials/pillar.rst @@ -247,8 +247,7 @@ A simple formula: .. code-block:: yaml vim: - pkg: - - installed + pkg.installed: [] /etc/vimrc: file.managed: @@ -266,8 +265,7 @@ Can be easily transformed into a powerful, parameterized formula: .. code-block:: jinja vim: - pkg: - - installed + pkg.installed: - name: {{ pillar['pkgs']['vim'] }} /etc/vimrc: diff --git a/doc/topics/tutorials/starting_states.rst b/doc/topics/tutorials/starting_states.rst index 40a398c246..1d079e5e82 100644 --- a/doc/topics/tutorials/starting_states.rst +++ b/doc/topics/tutorials/starting_states.rst @@ -67,10 +67,8 @@ A typical SLS file will often look like this in YAML: .. code-block:: yaml apache: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - require: - pkg: apache @@ -107,10 +105,8 @@ and a user and group may need to be set up. .. code-block:: yaml apache: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - watch: - pkg: apache - file: /etc/httpd/conf/httpd.conf @@ -455,11 +451,9 @@ a MooseFS distributed filesystem chunkserver: - pkg: mfs-chunkserver mfs-chunkserver: - pkg: - - installed + pkg.installed: [] mfschunkserver: - service: - - running + service.running: - require: {% for mnt in salt['cmd.run']('ls /dev/data/moose*') %} - mount: /mnt/moose{{ mnt[-1] }} diff --git a/doc/topics/tutorials/states_pt2.rst b/doc/topics/tutorials/states_pt2.rst index 855e70c72c..2cbbf36112 100644 --- a/doc/topics/tutorials/states_pt2.rst +++ b/doc/topics/tutorials/states_pt2.rst @@ -23,10 +23,8 @@ You can specify multiple :ref:`state-declaration` under an :emphasize-lines: 4,5 apache: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - require: - pkg: apache @@ -47,10 +45,8 @@ installed and running. Include the following at the bottom of your :emphasize-lines: 7,11 apache: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - require: - pkg: apache @@ -121,15 +117,12 @@ Verify that Apache is now serving your custom HTML. :emphasize-lines: 1,2,3,4,11,12 /etc/httpd/extra/httpd-vhosts.conf: - file: - - managed + file.managed: - source: salt://webserver/httpd-vhosts.conf apache: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - watch: - file: /etc/httpd/extra/httpd-vhosts.conf - require: diff --git a/doc/topics/tutorials/states_pt3.rst b/doc/topics/tutorials/states_pt3.rst index b5b777907c..33c7509bb8 100644 --- a/doc/topics/tutorials/states_pt3.rst +++ b/doc/topics/tutorials/states_pt3.rst @@ -88,8 +88,7 @@ The Salt module functions are also made available in the template context as .. code-block:: jinja moe: - user: - - present + user.present: - gid: {{ salt['file.group_to_gid']('some_group_that_exists') }} Note that for the above example to work, ``some_group_that_exists`` must exist diff --git a/doc/topics/tutorials/walkthrough.rst b/doc/topics/tutorials/walkthrough.rst index b3ddf16d36..c925a39af9 100644 --- a/doc/topics/tutorials/walkthrough.rst +++ b/doc/topics/tutorials/walkthrough.rst @@ -519,7 +519,7 @@ Now, to beef up the vim SLS formula, a ``vimrc`` can be added: .. code-block:: yaml vim: - pkg.installed + pkg.installed: [] /etc/vimrc: file.managed: @@ -553,10 +553,8 @@ make an nginx subdirectory and add an init.sls file: .. code-block:: yaml nginx: - pkg: - - installed - service: - - running + pkg.installed: [] + service.running: - require: - pkg: nginx diff --git a/salt/client/ssh/wrapper/grains.py b/salt/client/ssh/wrapper/grains.py index 94e96aa0d7..f6201225f8 100644 --- a/salt/client/ssh/wrapper/grains.py +++ b/salt/client/ssh/wrapper/grains.py @@ -158,11 +158,9 @@ def filter_by(lookup_dict, grain='os_family', merge=None): }) %} myapache: - pkg: - - installed + pkg.installed: - name: {{ apache.pkg }} - service: - - running + service.running: - name: {{ apache.srv }} Values in the lookup table may be overridden by values in Pillar. An diff --git a/salt/modules/daemontools.py b/salt/modules/daemontools.py index ccd3a78add..e853e7f490 100644 --- a/salt/modules/daemontools.py +++ b/salt/modules/daemontools.py @@ -9,8 +9,7 @@ so it can be used to maintain services using the ``provider`` argument: .. code-block:: yaml myservice: - service: - - running + service.running: - provider: daemontools ''' diff --git a/salt/modules/grains.py b/salt/modules/grains.py index 1758343a97..ea195e65fc 100644 --- a/salt/modules/grains.py +++ b/salt/modules/grains.py @@ -366,11 +366,9 @@ def filter_by(lookup_dict, grain='os_family', merge=None, default='default'): }), default='Debian' %} myapache: - pkg: - - installed + pkg.installed: - name: {{ apache.pkg }} - service: - - running + service.running: - name: {{ apache.srv }} Values in the lookup table may be overridden by values in Pillar. An diff --git a/salt/states/archive.py b/salt/states/archive.py index 0914d0c6a4..152cfc972a 100644 --- a/salt/states/archive.py +++ b/salt/states/archive.py @@ -47,8 +47,7 @@ def extracted(name, .. code-block:: yaml graylog2-server: - archive: - - extracted + archive.extracted: - name: /opt/ - source: https://github.com/downloads/Graylog2/graylog2-server/graylog2-server-0.9.6p1.tar.lzma - source_hash: md5=499ae16dcae71eeb7c3a30c75ea7a1a6 @@ -59,8 +58,7 @@ def extracted(name, .. code-block:: yaml graylog2-server: - archive: - - extracted + archive.extracted: - name: /opt/ - source: https://github.com/downloads/Graylog2/graylog2-server/graylog2-server-0.9.6p1.tar.gz - source_hash: md5=499ae16dcae71eeb7c3a30c75ea7a1a6 diff --git a/salt/states/blockdev.py b/salt/states/blockdev.py index 30025d4b29..638667fa6d 100644 --- a/salt/states/blockdev.py +++ b/salt/states/blockdev.py @@ -13,8 +13,7 @@ A state module to manage blockdevices - read-only: True master-data: - blockdev: - - tuned: + blockdev.tuned:: - name : /dev/vg/master-data - read-only: True - read-ahead: 1024 diff --git a/salt/states/cmd.py b/salt/states/cmd.py index a38fd89b81..6e35d80fba 100644 --- a/salt/states/cmd.py +++ b/salt/states/cmd.py @@ -147,17 +147,14 @@ executed when the state it is watching changes. Example: .. code-block:: yaml /usr/local/bin/postinstall.sh: - cmd: - - wait + cmd.wait: - watch: - pkg: mycustompkg - file: - - managed + file.managed: - source: salt://utils/scripts/postinstall.sh mycustompkg: - pkg: - - installed + pkg.installed: - require: - file: /usr/local/bin/postinstall.sh diff --git a/salt/states/glusterfs.py b/salt/states/glusterfs.py index 812b73bb3c..79ab7b556a 100644 --- a/salt/states/glusterfs.py +++ b/salt/states/glusterfs.py @@ -167,8 +167,7 @@ def started(name): .. code-block:: yaml mycluster: - glusterfs: - - started + glusterfs.started: [] ''' ret = {'name': name, 'changes': {}, diff --git a/salt/states/npm.py b/salt/states/npm.py index de7c1d67b7..9e8d353051 100644 --- a/salt/states/npm.py +++ b/salt/states/npm.py @@ -46,13 +46,11 @@ def installed(name, .. code-block:: yaml coffee-script: - npm: - - installed + npm.installed: - user: someuser coffee-script@1.0.1: - npm: - - installed + npm.installed: [] name The package to install diff --git a/salt/states/pkgng.py b/salt/states/pkgng.py index 15d7f54dcd..911a02a1d7 100644 --- a/salt/states/pkgng.py +++ b/salt/states/pkgng.py @@ -10,8 +10,7 @@ typically rather simple: .. code-block:: yaml pkgng_clients: - pkgng: - - update_packaging_site + pkgng.update_packaging_site: - name: "http://192.168.0.2" ''' diff --git a/salt/states/powerpath.py b/salt/states/powerpath.py index 0c3147dbc6..12ebd2a195 100644 --- a/salt/states/powerpath.py +++ b/salt/states/powerpath.py @@ -9,8 +9,7 @@ only addition/deletion of licenses is supported. .. code-block:: yaml key: - powerpath: - - license_present + powerpath.license_present: [] ''' diff --git a/salt/states/rabbitmq_plugin.py b/salt/states/rabbitmq_plugin.py index f2ad8b9f6a..95c91633d1 100644 --- a/salt/states/rabbitmq_plugin.py +++ b/salt/states/rabbitmq_plugin.py @@ -10,8 +10,7 @@ Example: .. code-block:: yaml some_plugin: - rabbitmq_plugin: - - enabled + rabbitmq_plugin.enabled: [] ''' # Import python libs diff --git a/salt/states/rvm.py b/salt/states/rvm.py index e3c226e924..e55e9bd885 100644 --- a/salt/states/rvm.py +++ b/salt/states/rvm.py @@ -15,8 +15,7 @@ configuration could look like: .. code-block:: yaml rvm: - group: - - present + group.present: [] user.present: - gid: rvm - home: /home/rvm @@ -25,7 +24,7 @@ configuration could look like: rvm-deps: pkg.installed: - - names: + - pkgs: - bash - coreutils - gzip @@ -38,7 +37,7 @@ configuration could look like: mri-deps: pkg.installed: - - names: + - pkgs: - build-essential - openssl - libreadline6 @@ -65,7 +64,7 @@ configuration could look like: jruby-deps: pkg.installed: - - names: + - pkgs: - curl - g++ - openjdk-6-jre-headless diff --git a/salt/states/service.py b/salt/states/service.py index f0c9f30145..6287e32d3f 100644 --- a/salt/states/service.py +++ b/salt/states/service.py @@ -9,16 +9,14 @@ rc scripts, services can be defined as running or dead. .. code-block:: yaml httpd: - service: - - running + service.running: [] The service can also be set to be started at runtime via the enable option: .. code-block:: yaml openvpn: - service: - - running + service.running: - enable: True By default if a service is triggered to refresh due to a watch statement the @@ -28,8 +26,7 @@ service, then set the reload value to True: .. code-block:: yaml redis: - service: - - running + service.running: - enable: True - reload: True - watch: diff --git a/salt/states/ssh_auth.py b/salt/states/ssh_auth.py index 49e35fe410..3236226a0c 100644 --- a/salt/states/ssh_auth.py +++ b/salt/states/ssh_auth.py @@ -15,27 +15,23 @@ to use a YAML 'explicit key', as demonstrated in the second example below. .. code-block:: yaml AAAAB3NzaC1kc3MAAACBAL0sQ9fJ5bYTEyY==: - ssh_auth: - - present + ssh_auth.present: - user: root - enc: ssh-dss ? AAAAB3NzaC1kc3MAAACBAL0sQ9fJ5bYTEyY==... : - ssh_auth: - - present + ssh_auth.present: - user: root - enc: ssh-dss thatch: - ssh_auth: - - present + ssh_auth.present: - user: root - source: salt://ssh_keys/thatch.id_rsa.pub sshkeys: - ssh_auth: - - present + ssh_auth.present: - user: root - enc: ssh-rsa - options: diff --git a/salt/states/supervisord.py b/salt/states/supervisord.py index b204a38628..6447fcd0bc 100644 --- a/salt/states/supervisord.py +++ b/salt/states/supervisord.py @@ -6,8 +6,7 @@ Interaction with the Supervisor daemon .. code-block:: yaml wsgi_server: - supervisord: - - running + supervisord.running: - require: - pkg: supervisor - watch: diff --git a/salt/states/tomcat.py b/salt/states/tomcat.py index b6530b2836..193e6f564d 100644 --- a/salt/states/tomcat.py +++ b/salt/states/tomcat.py @@ -187,21 +187,18 @@ def wait(name, url='http://localhost:8080/manager', timeout=180): .. code-block:: yaml tomcat-service: - service: - - running + service.running: - name: tomcat - enable: True wait-for-tomcatmanager: - tomcat: - - wait + tomcat.wait: - timeout: 300 - require: - service: tomcat-service jenkins: - tomcat: - - war_deployed + tomcat.war_deployed: - name: /ran - war: salt://jenkins-1.2.4.war - require: diff --git a/salt/states/win_system.py b/salt/states/win_system.py index b63a4aa047..d04a94d7c3 100644 --- a/salt/states/win_system.py +++ b/salt/states/win_system.py @@ -11,12 +11,10 @@ description. .. code-block:: yaml ERIK-WORKSTATION: - system: - - computer_name + system.computer_name: [] This is Erik's computer, don't touch!: - system: - - computer_desc + system.computer_desc: [] ''' # Import python libs