Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] No "pv.create" pillar data supplied - nothing to do! #21

Open
BillyBombardieri opened this issue Sep 21, 2021 · 8 comments
Open
Assignees

Comments

@BillyBombardieri
Copy link

BillyBombardieri commented Sep 21, 2021

$ sudo salt 'pt-prod-billy' pillar.items lvm

pt-prod-billy:
    ----------
    lvm:
        ----------
        pv:
            ----------
            create:
                ----------
                /dev/xvdc:
                    ----------
                    options:
                        ----------
                        verbose:
                            True

$ sudo salt 'pt-prod-billy' state.apply lvm.pv.create

pt-prod-billy:
----------
          ID: lvm_pv_create_nothing_to_do
    Function: test.show_notification
      Result: True
     Comment: No "pv.create" pillar data supplied - nothing to do!
     Started: 13:26:21.435264
    Duration:  1.043 ms

I have "No "..." pillar data supplied - nothing to do!" for all state, just with lvm-formula
With other formula, it's works.

@noelmcloughlin
Copy link
Member

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.

@BillyBombardieri
Copy link
Author

BillyBombardieri commented Sep 23, 2021

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

@BillyBombardieri
Copy link
Author

it works with version 3001.8 of salt-ssh

@kartnico
Copy link

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

@noelmcloughlin
Copy link
Member

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?

@noelmcloughlin noelmcloughlin self-assigned this Nov 18, 2021
@sh1ny
Copy link

sh1ny commented Nov 18, 2021

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.

@sh1ny
Copy link

sh1ny commented Nov 18, 2021

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]#

@noelmcloughlin
Copy link
Member

Okay, something wrong with map.jinja I suppose. Yes, please raise a PR to implement a fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants