Re: [qubes-users] Re: using salt - how to debug?

2020-05-18 Thread prago via qubes-users
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

I think the pillar files need to be in /srv/pillar/
The following example should work:

/srv/pillar/fedora-version.top
base:
  dom0:
    - fedora-version

/srv/pillar/fedora-version.sls
version: 31

Then the file needs to be linked to another directory:
ln -s /srv/pillar/fedora-version.top /srv/pillar/_tops/base/fedora-version.top

This can be tested with the following command:
sudo qubesctl pillar.get version
And can be used in salt files as you have used it
-BEGIN PGP SIGNATURE-

iIgEARMKADAWIQRFNnsoPo7HH0XEMXc88cBGMbAIWAUCXsMAEhIccHJhZ29AdHV0
YW5vdGEuZGUACgkQPPHARjGwCFjP2AD/bV5z2DEkRvGtHEbv32MbRAAPN1uZDvfR
MR9DzIPEKnUA/2Zfz12HtzdtA/pIEAZoDceKrNLp7iua2Lk8HyStuyUw
=eySN
-END PGP SIGNATURE-

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/M7djpTm--3-2%40tuta.io.


[qubes-users] Re: using salt - how to debug?

2020-05-18 Thread liked2

On 2020-05-17 17:08, unman wrote:

On Sun, May 17, 2020 at 09:55:00AM +0100, liked2-mmb7mzph...@public.gmane.org 
wrote:




You haven't included AppVmTobeChanged as a target:
qubesctl --show-output --targets=AppVmTobeChanged state.highstate

You should check that you aren't getting a mistaken dom0 call.



That made the trick. Thanks unman!

One step forward, but still a way to go:
Currently I'm struggling to use pillars in my scripts. I have my scripts in
/srv/salt/user_salt
/srv/salt/user_pillar

Trying to enable a script containing some constants doesn't work because they 
cannot be found.
The only way to use pillars for me is passing them at the command line:
qubesctl ... pillar='{"name": "value"}'

But in this case I get errors in some scripts like this:
TypeError encountered executing state.highstate: highstate() takes from 0 to 1 
positional arguments but 2 were given

after executing this commandline:
sudo qubesctl --show-output --target AppVmTobeChanged state.highstate pillar='{"name": 
"value"}'


Best case I'd manage to include pillars in my scripts. Any ideas how?



Can you post examples of the pillars you have written?
What exactly are you trying to do?



My current goal is to automate the update of a fedora template as soon as a new 
one is available.
I'm trying to achieve this by these steps:
1. creating a clone of the default template
2. update this template with packages for a special purpose template

Details:
I created a top file like this:

 /srv/salt/user_salt/create_my_special_purpose_template.top 
base:
 dom0:
  - match: nodegroup
  - user_salt.create-template-clone

 't-fedora-*-template-clone':
  - user_salt.install-pkgs-for-special-purpose-template

 /srv/salt/user_salt/create_my_special_purpose_template.top 

1. creating a clone of the default template is done by this file
 /srv/salt/user_salt/create-template-clone.sls 
create-template-clone:
 qvm.clone:
  - name: t-fedora-{{ pillar['version'] }}-special-purpose-template
  - source: fedora-{{ pillar['version'] }}-minimal

 /srv/salt/user_salt/create-template-clone.sls 

2. update this template with packages for a special purpose template
 /srv/salt/user_salt/install-pkgs-for-special-purpose-template.sls 

install-packages:
 pkg.installed:
  - pkgs:
- nano
  - refresh: True
 /srv/salt/user_salt/install-pkgs-for-special-purpose-template.sls 


In step 2 I'm trying to use pillars to be less dependent from the fedora 
version.

When I'm running the command:
sudo qubesctl --show-output --target t-fedora-31-template-clone state.highstate 
pillar='{"version": "31"}'

I get the error:
TypeError encountered executing state.highstate: highstate() takes from 0 to 1 
positional arguments but 2 were given

That's why I'm trying to include pillars at least as a file, but don't manage 
to include them, so that they could by used by step 1.


Thank you very much by reading this long story... :) And if you've suggestion 
to solve it I even more appreciate it. :))

--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/2466f4d6-de4b-d4bb-1a3c-766fe97ecde5%40gmx.de.


Re: [qubes-users] Re: using salt - how to debug?

2020-05-17 Thread unman
On Sun, May 17, 2020 at 09:55:00AM +0100, lik...@gmx.de wrote:
> 
> > 
> > You haven't included AppVmTobeChanged as a target:
> > qubesctl --show-output --targets=AppVmTobeChanged state.highstate
> > 
> > You should check that you aren't getting a mistaken dom0 call.
> > 
> 
> That made the trick. Thanks unman!
> 
> One step forward, but still a way to go:
> Currently I'm struggling to use pillars in my scripts. I have my scripts in
> /srv/salt/user_salt
> /srv/salt/user_pillar
> 
> Trying to enable a script containing some constants doesn't work because they 
> cannot be found.
> The only way to use pillars for me is passing them at the command line:
> qubesctl ... pillar='{"name": "value"}'
> 
> But in this case I get errors in some scripts like this:
> TypeError encountered executing state.highstate: highstate() takes from 0 to 
> 1 positional arguments but 2 were given
> 
> after executing this commandline:
> sudo qubesctl --show-output --target AppVmTobeChanged state.highstate 
> pillar='{"name": "value"}'
> 
> 
> Best case I'd manage to include pillars in my scripts. Any ideas how?
> 

Can you post examples of the pillars you have written?
What exactly are you trying to do?

-- 
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/20200517160810.GA32033%40thirdeyesecurity.org.


[qubes-users] Re: using salt - how to debug?

2020-05-17 Thread liked2





You haven't included AppVmTobeChanged as a target:
qubesctl --show-output --targets=AppVmTobeChanged state.highstate

You should check that you aren't getting a mistaken dom0 call.



That made the trick. Thanks unman!

One step forward, but still a way to go:
Currently I'm struggling to use pillars in my scripts. I have my scripts in
/srv/salt/user_salt
/srv/salt/user_pillar

Trying to enable a script containing some constants doesn't work because they 
cannot be found.
The only way to use pillars for me is passing them at the command line:
qubesctl ... pillar='{"name": "value"}'

But in this case I get errors in some scripts like this:
TypeError encountered executing state.highstate: highstate() takes from 0 to 1 
positional arguments but 2 were given

after executing this commandline:
sudo qubesctl --show-output --target AppVmTobeChanged state.highstate pillar='{"name": 
"value"}'


Best case I'd manage to include pillars in my scripts. Any ideas how?

--
You received this message because you are subscribed to the Google Groups 
"qubes-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to qubes-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qubes-users/1dda186c-6270-028b-198a-c0fe039e9d63%40gmx.de.