Is "service.running watch file" suitable to distribute the service binaries?

9 views
Skip to first unread message

Markus Kramer

unread,
Mar 25, 2015, 6:59:54 PM3/25/15
to salt-...@googlegroups.com
I have successfully used "service.running watch file" for a configuration file as in

MyService:
  service.running:
    - watch:
      - file: /somewhere/configfile



Is it advisable to use the same expression to also distribute the binaries (10MB in 100 files) as in

MyService:
  service.running:
    - watch:
      - file: /somewhere/configfile
      - file: /somewhere_else/binary1
      - file: /somewhere_else/binary2
::snip::
      - file: /somewhere_else/binary99
      - file: /somewhere_else/binary100

 
In an update, only 20 kb in 3 binary files are likely to change.
I like the idea to use the same expression for configuration files and binaries, but I dislike that I have to mention each and every file.

Is there a more suitable expression that also transfers only the changes?


Background: the binaries are bbfreezed Python.
Actually 3MB in 70 files are changed in an update, but only because the time stamps in .pyc files are not working properly (all .py files appear changed).
I can either fix the reason for the wrong time stamp or simply ignore them.


Thank you


Markus Kramer

unread,
Mar 25, 2015, 8:08:46 PM3/25/15
to salt-...@googlegroups.com
I forgot that distribution is done by the expression

/somewhere/configfile:
  file.managed:
    - source: salt://somewhere/configfile

And I found

/somewhere_else/MyService.d: file.recurse: - source: salt://somewhere_else/MyService.d

After reading on, I found https://github.com/saltstack/salt/issues/663 (requisites can use globs for matching)
The documentation http://docs.saltstack.com/en/latest/ref/states/requisites.html misses to mention that "watch file" can use a glob (*).

Tomorrow, I will try out

MyService:
  service.running:
    - watch:
      - file: /somewhere/configfile
      - file: /somewhere_else/MyService.d/*

Nicholas Capo

unread,
Mar 25, 2015, 8:45:49 PM3/25/15
to salt-...@googlegroups.com

Wow! Thanks for the hint about globs!

Nicholas


--
You received this message because you are subscribed to the Google Groups "Salt-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to salt-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages