On 2020-07-13 13:48, unman wrote:
On Sun, Jul 12, 2020 at 05:55:56PM +0100, liked2-mmb7mzph...@public.gmane.org 
wrote:
Hi,

I'm trying to build up my AppVms with saltstack and currently stuck with 
updating my firefox profile because it's located in a randomly generated 
directory (where xxxxxxx are random alpha-numerics):
/home/user/.mozilla/firefox/xxxxxxx.default-release/prefs.js

1st try with file.append from saltstack seems not to work with wildcards:

/home/user/.mozilla/firefox/*.default-release/prefs.js:
?? file.append:
?????? - text:
?????????? - user_pref("browser.startup.homepage", "https://www.ecosia.org/";);

2nd try with a for loop also fails:

{% for file in salt[cmd.run']('ls -l 
/home/user/.mozilla/firefox/*.default-release/prefs.js') %}
{{ file }}
{ file.find type=f 
name='/home/user/.mozilla/firefox/*.default-release/prefs.js' }
?? file.append:
?????? - text:
?????????? - user_pref("browser.startup.homepage", "https://www.ecosia.org/";);
{% endfor %}


Do you have a 3rd working example/suggestion?


Thanks in advance! P.


I'm a great believer in keeping salt as simple as possible.
In this case:
```
echo 'user_pref("browser.startup.homepage", "https://www.qubes-os.org"; ); ' >> 
/home/user/.mozilla/firefox/*.default-release/prefs.js :
   cmd.run

```

If you *do* want complexity, your 1st try is a non-starter, as you've
discovered.
In the 2nd, I wouldn't use a variable name which is also the name of a
salt module. Nor would I use `ls` and `file.find` together - what's the
point? Otherwise that looks workable.


I agree to use salt-KISS but, with using the command line in salt renders it 
somehow less useful from my point of view. For example I've to be careful not 
to execute that script twice etc.

You're right with the second try. I just mixed 2 solutions into 1 during 
copying.

2a was using "ls":
{% for file in salt[cmd.run']('ls -l 
/home/user/.mozilla/firefox/*.default-release/prefs.js') %}
{{ file }}
file.append:
 - text:
   - user_pref("browser.startup.homepage", "https://www.qubes-os.org";);
{% endfor %}

Unfortunately, this fails with the error:
- Rendering SLS 'base:my_script' failed: Jinja syntax error: expected token 
',', got 'string'; line 1

2b was an attempt to use the find functionality, but I didn't manage to get 
this working. Error message is:
{ file.find type=f 
name='/home/user/.mozilla/firefox/*.default-release/prefs.js' }
  file.append:
    - text:
      - user_pref("browser.startup.homepage", "https://www.qubes-os.org";);

This one fails basically with the same error.

Any other suggestions?

--
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/e5c90b18-7159-d53c-b5cf-95e2ee13a061%40gmx.de.

Reply via email to