Skip to content

Commit

Permalink
fix(saltbug): file.line is buggy; use file.prepend
Browse files Browse the repository at this point in the history
  • Loading branch information
noelmcloughlin committed Oct 4, 2019
1 parent d4d176f commit f72fe9e
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 57 deletions.
8 changes: 5 additions & 3 deletions iscsi/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ iscsi:
text: 'cfiscsi_load="YES"'
ietd:
name: iscsi_trgt
text: iscsi_trgt
text:
lio:
name: target_core_mod
text: target_core_mod
text:
fcoe:
name: fcoe_target
text: fcoe_target
text:
iser:
name: ('ib_iser', 'ib_isert', 'rdma_ucm', 'rdma_cm', 'ib_cm',)
text: null
Expand Down Expand Up @@ -103,6 +103,7 @@ iscsi:

initiator:
enabled: True
loadmodule: False
provider: open-iscsi
pkghold: False
pkgs:
Expand All @@ -114,6 +115,7 @@ iscsi:

target:
port: 3260
loadmodule: False
enabled: True
provider: lio
pkghold: False
Expand Down
4 changes: 2 additions & 2 deletions iscsi/initiator/kernel/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- set provider = iscsi.initiator.provider %}
{%- if provider in iscsi.config.kmodule %}
{%- if iscsi.target.loadmodule and iscsi.config.kmodule[provider]['name'] %}
include:
- {{ sls_service_clean }}
iscsi-initiator-kernel-clean-cmd-run:
cmd.run:
- name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }}
- name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }} || true
- onlyif: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }}
- require:
- sls: {{ sls_service_clean }}
Expand Down
37 changes: 13 additions & 24 deletions iscsi/initiator/kernel/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,38 +8,27 @@
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- set provider = iscsi.initiator.provider %}
{%- if provider in iscsi.config.kmodule %}
{%- if iscsi.initiator.loadmodule and iscsi.config.kmodule[provider]['name'] %}
include:
- {{ sls_service_install }}
iscsi-initiator-kernel-install-file-line:
file.line:
- onlyif: {{ iscsi.config.name.modprobe and 'text' in iscsi.config.kmodule[provider] }}
iscsi-initiator-kernel-install-file-prepend:
file.prepend:
- onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['text'] }}
- name: {{ iscsi.config.name.modprobe }}
- content: {{ iscsi.config.kmodule[provider]['text'] }}
- backup: True
{%- if not iscsi.initiator.enabled %}
- mode: delete
cmd.run:
- onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['name'] }}
- name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }}
- onlyif: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }}
{%- else %}
{%- if grains.os_family in ('FreeBSD',) %}
- mode: ensure
- after: 'autoboot_delay.*'
{%- else %}
- mode: ensure
- create: True
- match: None
{%- endif %}
- text: {{ iscsi.config.kmodule[provider]['text'] }}
- makedirs: True
iscsi-initiator-kernel-install-cmd-run:
{%- if iscsi.initiator.enabled %}
cmd.run:
- onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['name'] }}
- name: {{ iscsi.kernel.modload }} {{ iscsi.config.kmodule[provider]['name'] }}
- unless: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }}
{%- else %}
cmd.run:
- name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }}
- onlyif: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }}
{%- endif %}
- require:
- file: iscsi-initiator-kernel-install-file-line
- require_in:
- sls: {{ sls_service_install }}
Expand Down
6 changes: 6 additions & 0 deletions iscsi/osfamilymap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,17 @@ Arch:
open-iscsi:
- iscsi
- iscsid
kmodule:
lio:
name:
text:
initiator:
make:
gitrepo: https://aur.archlinux.org
cmd: makepkg -si --noconfirm -f
wanted: []
target:
loadmodule: True
pkgs:
wanted:
- linux-lts # For kernel scsi modules
Expand All @@ -133,6 +138,7 @@ FreeBSD:
wanted:
- net/open-isns
target:
loadmodule: True
provider: ctld
pkgs:
wanted:
Expand Down
2 changes: 2 additions & 0 deletions iscsi/osfingermap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ CentOS-7:
- libiscsi
- libiscsi-utils
target:
loadmodule: True
pkgs:
wanted:
- yum-plugin-versionlock
Expand All @@ -52,6 +53,7 @@ CentOS-8:
- libiscsi
- libiscsi-utils
target:
loadmodule: True
pkgs:
wanted:
- yum-plugin-versionlock
Expand Down
10 changes: 5 additions & 5 deletions iscsi/target/kernel/clean.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- set provider = iscsi.target.provider %}
{%- if provider in iscsi.config.kmodule %}
{%- if iscsi.target.loadmodule and iscsi.config.kmodule[provider]['name'] %}
include:
- {{ sls_service_clean }}
iscsi-target-kernel-clean-cmd-run:
cmd.run:
- name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }}
- name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }} || true
- onlyif: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }}
- require:
- sls: {{ sls_service_clean }}
iscsi-target-kernel-clean-file-line:
file.line:
- onlyif: {{ iscsi.config.name.modprobe and 'text' in iscsi.config.kmodule[provider] }}
- onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['text'] }}
- name: {{ iscsi.config.name.modprobe }}
- content: {{ iscsi.config.kmodule[provider]['text'] }}
- backup: True
- mode: delete
- quiet: True
- quiet: True #<-- not working?
{%- endif %}
{%- endif %}
33 changes: 10 additions & 23 deletions iscsi/target/kernel/install.sls
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,27 @@
{%- from tplroot ~ "/libtofs.jinja" import files_switch with context %}
{%- set provider = iscsi.target.provider %}
{%- if provider in iscsi.config.kmodule %}
{%- if iscsi.target.loadmodule and iscsi.config.kmodule[provider]['name'] %}
include:
- {{ sls_service_install }}
iscsi-target-kernel-install-file-line:
file.line:
- onlyif: {{ iscsi.config.name.modprobe and 'text' in iscsi.config.kmodule[provider] }}
iscsi-target-kernel-install-file-prepend:
file.prepend:
- onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['text'] }}
- name: {{ iscsi.config.name.modprobe }}
- content: {{ iscsi.config.kmodule[provider]['text'] }}
- require_in:
- cmd: iscsi-target-kernel-install-file-line
- backup: True
- text: {{ iscsi.config.kmodule[provider]['text'] }}
- makedirs: True
iscsi-target-kernel-install-cmd-run:
{%- if iscsi.target.enabled %}
{%- if grains.os_family in ('FreeBSD',) %}
- mode: replace
- after: 'autoboot_delay.*'
{%- else %}
- mode: ensure
- create: True
- match: None
{%- endif %}
cmd.run:
- onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['name'] }}
- name: {{ iscsi.kernel.modload }} {{ iscsi.config.kmodule[provider]['name'] }}
- name: {{ iscsi.kernel.modload }} {{ iscsi.config.kmodule[provider]['name'] }} || true
- unless: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }}
{%- else %}
cmd.run:
- onlyif: {{ iscsi.config.name.modprobe and iscsi.config.kmodule[provider]['name'] }}
- name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }}
- name: {{ iscsi.kernel.modunload }} {{ iscsi.config.kmodule[provider]['name'] }} || true
- onlyif: {{ iscsi.kernel.modquery }} {{ iscsi.config.kmodule[provider]['name'] }}
- mode: delete
{%- endif %}
- require:
- file: iscsi-target-kernel-install-file-line
- require_in:
- sls: {{ sls_service_install }}
Expand Down

0 comments on commit f72fe9e

Please sign in to comment.