saltstack-formulas / logrotate-formula

http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
23 stars 71 forks source link

Add support for Ubuntu (16.04, 18.04) #51

Closed grandmotivator closed 4 years ago

grandmotivator commented 4 years ago

Add support for Ubuntu (16.04, 18.04)

myii commented 4 years ago

@grandmotivator That's already there:

https://github.com/saltstack-formulas/logrotate-formula/blob/d08d9bfa06300073e768d7a7b1471af3cc89a203/kitchen.yml#L73-L75

https://github.com/saltstack-formulas/logrotate-formula/blob/d08d9bfa06300073e768d7a7b1471af3cc89a203/kitchen.yml#L108-L110

https://travis-ci.com/saltstack-formulas/logrotate-formula/builds/131610312

What's not working for you?

grandmotivator commented 4 years ago

ubuntu-16.04, salt-2019.2.2 - After connecting the formula, the logrotate configs in the Ubuntu system are not replaced. No errors with "state.apply".

https://github.com/saltstack-formulas/logrotate-formula/blame/master/docs/README.rst#L20 - this may be an omission, but Ubuntu is not listed here

myii commented 4 years ago

@grandmotivator The README may not be up to date but the formula definitely works on Ubuntu. Taking the debug log for 18.04 in Travis, starting from here:

You can see that after managing the /etc/logrotate.conf file, all of the specific configurations are added under /etc/logrotate.d/.

If you can share your pillar and also what configuration files you're expecting for the formula to manage, then we can establish whether there is a bug or a misconfiguration.

grandmotivator commented 4 years ago

In my case all files from /etc/logrotate.conf and /etc/logrotate.d/ remain unchanged after state.apply.

myii commented 4 years ago

@grandmotivator Please share your pillar and the contents of (some of) the files.

myii commented 4 years ago

@grandmotivator The idea is that we can prepare a failing test in Travis, to show that there's a bug. But I need your configuration to be able to do that.

myii commented 4 years ago

@grandmotivator OK, I'm using this pillar in Travis with the 18.04 and 16.04 instances to see what it produces.

myii commented 4 years ago

@grandmotivator All appears to be working fine: https://travis-ci.org/myii/logrotate-formula/builds/642347529. I've even configured it to output the files after managing them:

The only thing left is your top.sls. Perhaps you don't have logrotate.jobs included:

https://github.com/saltstack-formulas/logrotate-formula/blob/d08d9bfa06300073e768d7a7b1471af3cc89a203/kitchen.yml#L181-L187

grandmotivator commented 4 years ago

Why is it not enough to use just that? Without logrotate.jobs. Is this a feature of a formula call? Differs from the output of other formulas, for example nginx.

https://github.com/saltstack-formulas/logrotate-formula/blob/d08d9bfa06300073e768d7a7b1471af3cc89a203/kitchen.yml#L181-L186

myii commented 4 years ago

It's in the README:

Installs the logrotate package and service/timer/cron.

https://github.com/saltstack-formulas/logrotate-formula/blob/d08d9bfa06300073e768d7a7b1471af3cc89a203/logrotate/init.sls#L4-L7

For the jobs, you need:

Create custom job for logrotate.

Looking inside that file, there's already an include for logrotate:

https://github.com/saltstack-formulas/logrotate-formula/blob/d08d9bfa06300073e768d7a7b1471af3cc89a203/logrotate/jobs.sls#L5-L6

So you could just use the - logrotate.jobs in your top.sls by itself, to do everything.


Does this solve your issue? If so, please go ahead and close it.

grandmotivator commented 4 years ago

@myii thanks, its working

myii commented 4 years ago

You're welcome, @grandmotivator.