Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(FreeBSD): add support #33

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

alxwr
Copy link
Member

@alxwr alxwr commented Jan 21, 2024

PR progress checklist (to be filled in by reviewers)

  • Changes to documentation are appropriate (or tick if not required)
  • Changes to tests are appropriate (or tick if not required)
  • Reviews completed

What type of PR is this?

This MR adds some minor adjustments to make this formula work on FreeBSD systems.

Primary type

  • [build] Changes related to the build system
  • [chore] Changes to the build process or auxiliary tools and libraries such as documentation generation
  • [ci] Changes to the continuous integration configuration
  • [feat] A new feature
  • [fix] A bug fix
  • [perf] A code change that improves performance
  • [refactor] A code change that neither fixes a bug nor adds a feature
  • [revert] A change used to revert a previous commit
  • [style] Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc.)

Secondary type

  • [docs] Documentation changes
  • [test] Adding missing or correcting existing tests

Does this PR introduce a BREAKING CHANGE?

No.

Related issues and/or pull requests

Describe the changes you're proposing

  • FreeBSD does not support grains.init. So this MR uses grains.get('init', 'unknown')
  • FreeBSD's root group is wheel. The osfamilymap accounts for that now.
  • FreeBSD's configuration directory for ports is /usr/local/etc/. The osfamilymap accounts for that now.

Pillar / config required to test the proposed changes

none needed

Debug log showing how the proposed changes work

Example with zero config on FreeBSD 13:

----------                                                                                                                                 
          ID: syslog_ng/package/install                                                                                                    
    Function: pkg.installed                                                                                                                
        Name: syslog-ng                                                                                                                    
      Result: True                                                                                                                         
     Comment: The following packages were installed/updated: syslog-ng                                                                     
     Started: 14:35:25.954231                                                                                                              
    Duration: 2019.921 ms                                                                                                                  
     Changes:                                                                                                                              
              ----------                                                                                                                   
              curl:                                                                                                                        
                  ----------                                                                                                               
                  new:                                                                                                                     
                      8.5.0                                                                                                                
                  old:                                                                                                                     
              e2fsprogs-libuuid:                                                                                                           
                  ----------                                                                                                               
                  new:                                                                                                                     
                      1.47.0                                                                                                               
                  old:                                                                                                                     
              glib:                                                                                                                        
                  ----------                                                                                                               
                  new:                                                                                                                     
                      2.78.3,2                                                                                                             
                  old:                                                                                                                     
              ivykis:                                                                                                                      
                  ----------                                                                                                               
                  new:                                                                                                                     
                      0.42.4                                                                                                               
                  old:                                                                                                                     
              syslog-ng:                                                                                                                   
                  ----------                                                                                                               
                  new:
                      4.4.0
                  old:
----------                                                                                                                                 
          ID: syslog_ng/config/install                                                                                                     
    Function: file.managed                                                                                                                 
        Name: /usr/local/etc/syslog-ng/syslog-ng.conf                                                                                      
      Result: True                                                                                                                         
     Comment: File /usr/local/etc/syslog-ng/syslog-ng.conf updated                                                                         
     Started: 14:42:39.125691                                                                                                              
    Duration: 161.943 ms                                                                                                                   
     Changes:                                                                                                                              
              ----------                                                                                                                   
              diff:                                                                                                                        
                  ---                                                                                                                      
                  +++                                                                                                                      
                  @@ -1,53 +1,11 @@                                                                                                        
                  -###############################################################################                                         
                  -# Modular syslog-ng configuration, with one log file per daemon or logpath                                              
                  -#                                                                                                                       
                  -# The log files are stored below /var/log/syslog/<daemon>.log                                                           
                  -# Log messages which aren't assosiated with a specifc logpath or daemon will be                                         
                  -# logged to the catch-all /var/log/messages log file.                                                                   
                  -#                                                                                                                       
                  -# Authors:                                                                                                              
                  -#  Christian Affolter <[email protected]>                                                            
                  -#                                                                                                                       
                  +########################################################################                                                
                  +# File managed by Salt at <salt://syslog_ng/files/default/syslog-ng.conf>.                                              
                  +# Your changes will be overwritten.                                                                                     
                  +########################################################################                                                
                                                                                                                                           
                  -@version: 3.2                                                                                                           
                  -@include "scl.conf"                                                                                                     
                  +@version: 3.3                                                                                                           
                  +                                                                                                                        
                  +options {                                                                                                               
                  +};                                                                                                                      
                                                                                                                                           
                                                                                                                                           
                  -### Global and environmental variables ###                                                                              
                  -#                                                                                                                       
                  -# default filesystem log path
                  -@define log_base_dir "/var/log"
                  -@define syslog_dir "/var/log/syslog"
                  -
                  -# include base directory
                  -@define include_base_dir "/usr/local/etc/syslog-ng/syslog-ng.conf.d"
                  -
                  -
                  -### Options ###
                  -#
                  -# include all options definitions
                  -include "`include_base_dir`/option.d";
                  -
                  -
                  -### Sources ###
                  -#
                  -# include all log sources
                  -include "`include_base_dir`/source.d";
                  -
                  -
                  -### Filters ###
                  -#
                  -# include all common filters
                  -include "`include_base_dir`/filter.d";
                  -
                  -
                  -### Destinations ###
                  -#
                  -# include all common destinations
                  -include "`include_base_dir`/destination.d";
                  -
                  -
                  -### Log paths ###
                  -#
                  -# include all log destinations
                  -include "`include_base_dir`/log.d";
----------
          ID: syslog_ng/service/running
    Function: service.running
        Name: syslog-ng
      Result: True
     Comment: Service syslog-ng has been enabled, and is running
     Started: 14:42:39.289248
    Duration: 416.032 ms
     Changes:   
              ----------
              syslog-ng:
                  True

Summary for host
------------
Succeeded: 3 (changed=3)
Failed:    0
------------
Total states run:     3
Total run time: 651.525 ms

Documentation checklist

  • Updated the README (e.g. Available states).
  • Updated pillar.example.

Testing checklist

  • Included in Kitchen (i.e. under state_top).
  • Covered by new/existing tests (e.g. InSpec, Serverspec, etc.).
  • Updated the relevant test pillar.

Additional context

@alxwr alxwr requested a review from myii January 21, 2024 14:14
@alxwr alxwr self-assigned this Jan 21, 2024
@alxwr alxwr requested review from n-rodriguez and removed request for myii February 9, 2024 00:39
@n-rodriguez n-rodriguez merged commit 2c13f3d into saltstack-formulas:master Feb 9, 2024
1 of 5 checks passed
@alxwr alxwr deleted the freebsd-support branch February 9, 2024 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants