1
0
Fork 0
Commit Graph

38 Commits

Author SHA1 Message Date
Imran Iqbal 650cfaddf0
test: standardise use of `share` suite & `_mapdata` state [skip ci]
* Automated using https://github.com/myii/ssf-formula/pull/302
2021-03-23 21:29:48 +00:00
Javier Bértoli 335c9e6308 fix(debian-10): disable login_records, they're managed by the package 2020-06-26 13:52:08 -03:00
Javier Bértoli aced96bbf7 chore(map.jinja): update map to match template's 2020-06-26 13:24:57 -03:00
Imran Iqbal 57c88a8140
fix: make necessary modifications to get working on `salt-ssh`
* https://freenode.logbot.info/saltstack-formulas/20200506#c3811885-c3812572
* Avoid `defaults.merge`
* Send template values by `context`, to avoid:

```python
      ID: logrotate-config
Function: file.managed
    Name: /etc/logrotate.conf
  Result: False
 Comment: An exception occurred in this state: Traceback (most recent call last):
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/utils/templates.py", line 394, in render_jinja_tmpl
              output = template.render(**decoded_context)
            File "/var/tmp/.root_08c4d3_salt/pyall/jinja2/environment.py", line 1008, in render
              return self.environment.handle_exception(exc_info, True)
            File "/var/tmp/.root_08c4d3_salt/pyall/jinja2/environment.py", line 780, in handle_exception
              reraise(exc_type, exc_value, tb)
            File "/var/tmp/.root_08c4d3_salt/pyall/jinja2/_compat.py", line 37, in reraise
              raise value.with_traceback(tb)
            File "<template>", line 1, in top-level template code
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/utils/jinja.py", line 193, in get_source
              raise TemplateNotFound(template)
          jinja2.exceptions.TemplateNotFound: logrotate/map.jinja

          During handling of the above exception, another exception occurred:

          Traceback (most recent call last):
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/state.py", line 1981, in call
              **cdata['kwargs'])
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/loader.py", line 1977, in wrapper
              return f(*args, **kwargs)
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/states/file.py", line 3037, in managed
              **kwargs
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/modules/file.py", line 4846, in check_managed_changes
              **kwargs)
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/modules/file.py", line 4287, in get_managed
              **kwargs)
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/utils/templates.py", line 169, in render_tmpl
              output = render_str(tmplstr, context, tmplpath)
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/utils/templates.py", line 443, in render_jinja_tmpl
              trace=tracestr)
          salt.exceptions.SaltRenderError: Jinja error: logrotate/map.jinja
          Traceback (most recent call last):
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/utils/templates.py", line 394, in render_jinja_tmpl
              output = template.render(**decoded_context)
            File "/var/tmp/.root_08c4d3_salt/pyall/jinja2/environment.py", line 1008, in render
              return self.environment.handle_exception(exc_info, True)
            File "/var/tmp/.root_08c4d3_salt/pyall/jinja2/environment.py", line 780, in handle_exception
              reraise(exc_type, exc_value, tb)
            File "/var/tmp/.root_08c4d3_salt/pyall/jinja2/_compat.py", line 37, in reraise
              raise value.with_traceback(tb)
            File "<template>", line 1, in top-level template code
            File "/var/tmp/.root_08c4d3_salt/pyall/salt/utils/jinja.py", line 193, in get_source
              raise TemplateNotFound(template)
          jinja2.exceptions.TemplateNotFound: logrotate/map.jinja

          ; line 1

          ---
          {%- from "logrotate/map.jinja" import logrotate with context -%}    <======================
          {%- set config = salt['pillar.get']('logrotate:default_config', logrotate.default_config) -%}

          {%- set processed_parameters = [] -%}

          {%- macro set_parameter(parameter, default=None) -%}
          [...]
```
2020-05-06 15:42:57 +01:00
Imran Iqbal 86aed1ebae
feat(yamllint): include for this repo and apply rules throughout
* Semi-automated using `ssf-formula` (v0.5.0)
* Fix errors shown below:

```bash
logrotate-formula$ $(grep "\- yamllint" .travis.yml | sed -e "s:^\s\+-\s\(.*\):\1:")
./logrotate/osmap.yaml
  1:1       warning  missing document start "---"  (document-start)

./logrotate/osfamilymap.yaml
  1:1       warning  missing document start "---"  (document-start)
  7:15      warning  truthy value should be one of [false, true]  (truthy)
  12:14     warning  truthy value should be one of [false, true]  (truthy)
  14:23     warning  truthy value should be one of [false, true]  (truthy)
  16:14     warning  truthy value should be one of [false, true]  (truthy)
  24:14     warning  truthy value should be one of [false, true]  (truthy)

./logrotate/defaults.yaml
  4:1       warning  missing document start "---"  (document-start)
  11:23     warning  truthy value should be one of [false, true]  (truthy)
  13:13     warning  truthy value should be one of [false, true]  (truthy)
  15:13     warning  truthy value should be one of [false, true]  (truthy)
  16:1      error    too many blank lines (1 > 0)  (empty-lines)

pillar.example
  3:1       warning  missing document start "---"  (document-start)
  5:4       warning  missing starting space in comment  (comments)
  6:6       warning  missing starting space in comment  (comments)
  6:5       warning  comment not indented like content  (comments-indentation)
  7:6       warning  missing starting space in comment  (comments)
  9:13      warning  truthy value should be one of [false, true]  (truthy)
  11:13     warning  truthy value should be one of [false, true]  (truthy)
  12:15     warning  truthy value should be one of [false, true]  (truthy)
  13:14     warning  truthy value should be one of [false, true]  (truthy)
  26:12     error    trailing spaces  (trailing-spaces)
  48:12     error    too many spaces after hyphen  (hyphens)
  69:1      error    too many blank lines (1 > 0)  (empty-lines)
```
2019-08-08 10:59:16 +01:00
Eric Veiras Galisson ef88f3d047 fix: corrected indentation on context in file.managed states 2019-04-11 15:04:32 +02:00
waynegemmell 235f677bc6
Updated to | json for backward compatibility 2019-03-11 20:46:15 +02:00
waynegemmell 06859f5fbb
Context data wrapped with tojson filter. 2019-03-11 16:45:10 +02:00
waynegemmell 03fde1b616
Updated package install with json filter
This issue is causing logrotate install to fail. https://github.com/saltstack/salt/issues/51925
I've added | json to mitigate.
2019-03-06 09:46:26 +02:00
Eric Veiras Galisson 0d039778f8 integrating patch from danny-smit, fixes #33 2018-12-05 22:08:20 +01:00
Javier Bértoli 788d08811f Re-add map.jinja changes from #36 lost on #36 2018-11-14 17:27:15 -03:00
Javier Bértoli ea46350673 Make sure dependencies are installed if required, fix tests 2018-10-26 08:54:02 -03:00
Mark Gomersbach db3629904c
Move os_family and os mapping to yaml files
- Add Gentoo support
- Add FreeBSD support
2018-10-15 16:45:15 +02:00
Eric Veiras Galisson 4ac8535dd7 new possibility to configure a job giving the raw content to store as a file 2018-07-12 12:44:01 +02:00
David Seira c21746bb64 Added salt tag in job template 2017-11-23 21:01:23 +01:00
Andre Sencioles fabbb440bc Compress rotated files by default on Debian 2017-03-29 18:06:25 +13:00
Gilles Dartiguelongue 6c3292430d Fix retrieving configuration from pillar 2017-02-14 17:45:52 +01:00
Gilles Dartiguelongue 0ac29dd03f Fix deep merge of settings 2017-02-14 17:13:57 +01:00
Gilles Dartiguelongue 98e6f6a909 Add support for default logrotate options 2017-02-14 17:13:57 +01:00
Gilles Dartiguelongue 0846ae41e3 Rename state identifiers
Just for cosmetics
2017-02-14 17:13:57 +01:00
Gilles Dartiguelongue f0cf823177 Split init.sls into config, install and service
Following the template-formula example.
2017-02-14 17:13:57 +01:00
Gilles Dartiguelongue 1c6661a485 Move common settings to defaults.yaml 2017-02-14 17:09:22 +01:00
kramer 89c5fbaa92 add Scientific Linux support 2017-02-08 16:57:08 -06:00
Andre Sencioles 6dd570ad43 No need to reload the service on configuration change 2017-01-25 09:40:36 +13:00
Alejandro Bednarik dc7d03434b Updates logrotate.conf for Debian
/var/log group in Ubuntu is syslog. This formula breaks
Ubuntu logrotate.
2016-06-17 08:50:38 -03:00
edwin fdfb263e09 Support multiple log path 2015-11-20 11:33:35 +08:00
Wolodja Wentland 624700a372 Use items() in lieu of iteritems()
The iteritems dictionary method has been removed in Python 3 and using
items() is typically no problem in our case due to the fact that
dictionaries are rather small.

This fixes #15
2015-10-12 17:22:12 +02:00
Wolodja Wentland 6b15f6490c Define pillar default for logrotate:jobs
This allows users to target this states to minions for which no pillar
has been defined (yet).
2015-10-12 17:21:04 +02:00
Niels Abspoel 590b9eb56f add logrotate.conf for suse 2015-10-02 20:05:54 +02:00
Nicole Scherfenberg e70f0818d8 fixes issue #5
splits config file name and log file path, so you configure both.
This fixes #5.
2015-05-05 15:20:54 +02:00
Michal Galet 73c86743e2 Change the default service name to 'crond' for RHEL based systems. 2015-04-02 15:28:51 +02:00
nmadhok c335f5edbc Moving logrotate directory setup from jobs.sls and config.sls to init.sls. Closes #8 2015-03-20 16:05:14 -04:00
Niels Abspoel f142bc6a48 Added opensuse support 2015-03-07 11:27:15 +01:00
Niels Abspoel 9c8e2bdc63 added Fedora to map.jinja
it's crond service on fedora that initiates logrotate
2015-02-07 10:08:08 +01:00
root e730dc8989 add return support lookup 2015-01-22 09:08:21 +08:00
root cfc24f6ead add support jobs 2015-01-21 18:00:07 +08:00
Niels Abspoel 6f1b01d59f fix logrotate service name to cron instead of crond 2015-01-06 20:06:50 +01:00
Niels Abspoel 38808d6221 Initial commit to add all files 2015-01-01 19:52:08 +01:00