Skip to content

Commit

Permalink
refactor(states): set state IDs based on a dependable structure
Browse files Browse the repository at this point in the history
* Based on:
  - saltstack-formulas#48 (comment)
  - saltstack-formulas#48 (comment)

Consistent structure using 5 parts to the state ID naming:

* 3 parts from the filename:
  - `template/package/install.sls`
* 2 parts from the state:
  - `pkg.installed`
* In the structure:
  - `<formula>-<subdir1>-<subdir2>-<state1>-<state2>`
* Putting together to get:
  - `template-package-install-pkg-installed`

BREAKING CHANGE: Wholesale state ID changes will break implementations
that are relying on the previous state IDs for requisite purposes.
  • Loading branch information
myii committed Feb 28, 2019
1 parent 2cd82e5 commit 6690ee6
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion template/config/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
include:
- {{ sls_service_clean }}
template-config-absent:
template-config-clean-file-absent:
file.absent:
- name: {{ template.config }}
- require:
Expand Down
2 changes: 1 addition & 1 deletion template/config/file.sls
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
include:
- {{ sls_package_install }}
template-config:
template-config-file-file-managed:
file.managed:
- name: {{ template.config }}
- source: {{ files_switch(
Expand Down
2 changes: 1 addition & 1 deletion template/package/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
include:
- {{ sls_config_clean }}
template-pkg-removed:
template-package-clean-pkg-removed:
pkg.removed:
- name: {{ template.pkg }}
- require:
Expand Down
2 changes: 1 addition & 1 deletion template/package/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import template with context %}
template-pkg:
template-package-install-pkg-installed:
pkg.installed:
- name: {{ template.pkg }}
2 changes: 1 addition & 1 deletion template/service/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{%- set tplroot = tpldir.split('/')[0] %}
{%- from tplroot ~ "/map.jinja" import template with context %}
template-service-dead:
template-service-clean-service-dead:
service.dead:
- name: {{ template.service.name }}
- enable: False
2 changes: 1 addition & 1 deletion template/service/running.sls
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
include:
- {{ sls_config_file }}
template-service:
template-service-running-service-running:
service.running:
- name: {{ template.service.name }}
- enable: True
Expand Down

0 comments on commit 6690ee6

Please sign in to comment.