[qubes-users] Re: saltstack used to update firefox profile

2020-07-15 Thread liked2

On 2020-07-15 14:09, unman wrote:

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.

Actually, in this case you*dont*  need to worry about that, because
afaik firefox will only keep the last entry and will prune the others.


You're right with the second try. I just mixed 2 solutions into 1 during 
copying.
This one fails basically with the same error.



Any other suggestions?



unman, as always very appreciated for your help. That did the trick.

--
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/ac650b11-acff-e0d5-475c-2314e9c42768%40gmx.de.


Re: [qubes-users] Re: saltstack used to update firefox profile

2020-07-15 Thread unman
On Mon, Jul 13, 2020 at 06:22:57PM +0100, lik...@gmx.de wrote:
> 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 xxx are random alpha-numerics):
> > > /home/user/.mozilla/firefox/xxx.default-release/prefs.js
> > > 
> > 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.

Actually, in this case you *dont* need to worry about that, because
afaik firefox will only keep the last entry and will prune the others.

> 
> You're right with the second try. I just mixed 2 solutions into 1 during 
> copying.
> This one fails basically with the same error.
 
> Any other suggestions?
> 

```
{% set filenames=salt['file.find']('/home/user/.mozilla/firefox', 
'name=prefs.js') %}
{% for value in filenames %}
{{ value }}:
  file.append:
- text: 'user_pref("browser.startup.homepage", "https://www.qubes-os.org";); 
' 
{% endfor %}
```

The problem with this is that it relies on you having started firefox
already (to generate the .mozilla entries).
You used to be able to get the same effect before opening by editing
/etc/firefox-esr/firefox-esr.js , but that doesn't seem to work. In any
case you would need to do this in the template.
I'm sure you can find the right place to edit *before* starting firefox.

unman

-- 
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/20200715130911.GA16571%40thirdeyesecurity.org.


[qubes-users] Re: saltstack used to update firefox profile

2020-07-13 Thread liked2

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 xxx are random alpha-numerics):
/home/user/.mozilla/firefox/xxx.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.