Open BillyBombardieri opened 3 years ago
Looks correct to me.
You need to supply some data to lvm.pv.create
... see the examples:
https://github.com/saltstack-formulas/lvm-formula/blob/master/pillar.example#L38-L87
Instead of throwing an exception (dictionary is null) it prints lvm_pv_create_nothing_to_do
state.
I have this In my state and it don't work @noelmcloughlin :
lvm:
pv:
create:
/dev/xvdc: {}
vg:
create:
data-vg:
devices:
- /dev/xvdc
And the two machines are ubuntu 20.04
it works with version 3001.8 of salt-ssh
Hello,
I have the same concern on my "lvm.vg.rename" state.
local:
----------
ID: lvm_vg_rename_nothing_to_do
Function: test.show_notification
Result: True
Comment: No "vg.rename" pillar data supplied - nothing to do!
Started: 10:34:53.522581
Duration: 0.619 ms
Changes:
Summary for local
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 0.619 ms
My pillars
# vim: sts=2 ts=2 sw= et ai
#
---
lvm:
vg:
rename:
debian-11-vg:
newname: vg_sys
My command
$ sudo salt-call state.apply lvm.vg.rename test=true
My result
local:
----------
ID: lvm_vg_rename_nothing_to_do
Function: test.show_notification
Result: True
Comment: No "vg.rename" pillar data supplied - nothing to do!
Started: 10:36:53.283371
Duration: 1.063 ms
Changes:
Summary for local
------------
Succeeded: 1
Failed: 0
------------
Total states run: 1
Total run time: 1.063 ms
My version of Salt
Salt Version:
Salt: 3002.6
Dependency Versions:
cffi: Not Installed
cherrypy: Not Installed
dateutil: 2.8.1
docker-py: Not Installed
gitdb: Not Installed
gitpython: Not Installed
Jinja2: 2.11.3
libgit2: 1.1.0
M2Crypto: Not Installed
Mako: Not Installed
msgpack: 1.0.0
msgpack-pure: Not Installed
mysql-python: Not Installed
pycparser: Not Installed
pycrypto: Not Installed
pycryptodome: 3.9.7
pygit2: 1.4.0
Python: 3.9.2 (default, Feb 28 2021, 17:03:44)
python-gnupg: Not Installed
PyYAML: 5.3.1
PyZMQ: 20.0.0
smmap: Not Installed
timelib: Not Installed
Tornado: 4.5.3
ZMQ: 4.3.4
System Versions:
dist: debian 11 bullseye
locale: utf-8
machine: x86_64
release: 5.10.0-8-amd64
system: Linux
version: Debian GNU/Linux 11 bullseye
Could you edit lvm/pv/create.sls
or lvm/vg/rename.sls
and change the text
from: No "xx.xxxx" pillar data supplied - nothing to to!
to: No "xx.xxxx" pillar data supplied {{ lvm }} - nothing to do!
i.e. what is value of lvm
jinja2 variable when these commands are executed. It's type should be dict but seems to be None?
Getting the same. Here's what {{ lvm }} outputs:
----------
ID: lvm_pv_create_nothing_to_do
Function: test.show_notification
Result: True
Comment: No "pv.create" pillar data supplied {'pkgs': ['lvm2', 'cryptsetup', 'device-mapper-persistent-data'], 'cfgsource': 'salt://lvm/templates/conf.jinja', 'group': 'root', 'filemode': '0640', 'dir_mode': '0755', 'files': {'loopbackdir': '/tmp/loopdevs'}, 'kmodules': [], 'config': {'dir': {'profiles': '/etc/lvm/profile', 'backups': '/etc/lvm/backup'}}, 'profiles': {'default': {'thin-generic': {}, 'cache-mq': {}, 'command_profile_templater': {}, 'cache-smq': {}, 'lvmdbusd': {}}, 'remove': {}, 'create': {}, 'man5': {'manpage': 'lvm.conf(5)', 'vendor': 'kernel', 'format': {'div': '=', 'ucl': False, 'json': False}}}, 'vg': {'enable_export': False, 'enable_cfgrestore': False}, 'pv': {}, 'lv': {}, 'vgbase': ['lvroot']} - nothing to do!
Started: 15:02:56.105095
Duration: 1.38 ms
Changes:
It's not only the pv.create, none of the lv,vg,pv work.
This seems to fix it. However this is a temp fix, i guess a proper one is in order ?
[root@dev-saltmaster001 lvm-formula]# git diff
diff --git a/lvm/map.jinja b/lvm/map.jinja
index c84acd2..02edb85 100644
--- a/lvm/map.jinja
+++ b/lvm/map.jinja
@@ -41,7 +41,8 @@
)
%}
-{%- set lvm = config %}
+# {%- set lvm = config %}
+{%- set lvm = salt['pillar.get']('lvm', default=defaults, merge=True) %}
{#- Post-processing for specific non-YAML customisations #}
{%- if grains.os == 'MacOS' %}
diff --git a/lvm/pv/create.sls b/lvm/pv/create.sls
index 0fe6977..b7fbfd9 100644
--- a/lvm/pv/create.sls
+++ b/lvm/pv/create.sls
@@ -18,6 +18,6 @@ lvm_pv_create_{{ pv }}:
lvm_pv_create_nothing_to_do:
test.show_notification:
- text: |
- No "pv.create" pillar data supplied - nothing to do!
+ No "pv.create" pillar data supplied {{ lvm }} - nothing to do!
{%- endif %}
[root@dev-saltmaster001 lvm-formula]#
Okay, something wrong with map.jinja I suppose. Yes, please raise a PR to implement a fix.
$ sudo salt 'pt-prod-billy' pillar.items lvm
$ sudo salt 'pt-prod-billy' state.apply lvm.pv.create
I have "No "..." pillar data supplied - nothing to do!" for all state, just with lvm-formula With other formula, it's works.