feat: Add pre-commit

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2024-04-27 17:31:37 +02:00
parent 7b2b1b8329
commit 0063f2157c
No known key found for this signature in database
GPG key ID: A2EB1F2CA8E3F677
7 changed files with 30 additions and 7 deletions

15
.github/workflows/pre-commit.yml vendored Normal file
View file

@ -0,0 +1,15 @@
---
name: pre-commit
on:
pull_request:
push:
branches: [main]
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v3
- uses: pre-commit/action@v3.0.1

9
.pre-commit-config.yaml Normal file
View file

@ -0,0 +1,9 @@
---
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-yaml
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace

View file

@ -44,7 +44,7 @@ sub dump_sqlite3
sub setup_env_pgsql
{
my %args = @_;
my $username = getpwuid $ENV{'UID'};
my $username = getpwuid $ENV{'UID'};
umask(0077);
if ($args{db_address}) {
@ -93,7 +93,7 @@ sub setup_env_mysql
my %args = @_;
umask(0077);
unlink("$wd/.my.cnf");
open(MY, ">$wd/.my.cnf")
open(MY, ">$wd/.my.cnf")
or die "Can't open $wd/.my.cnf for writing $@";
$args{db_address} = $args{db_address} || "localhost";

View file

@ -20,5 +20,5 @@ Alias /nagios4 /usr/share/nagios4/htdocs
</DirectoryMatch>
<Directory /usr/share/nagios4/htdocs>
Options +ExecCGI
Options +ExecCGI
</Directory>

View file

@ -21,7 +21,7 @@
comment: allow ping from the world
- name: Deny input connections by default
ansible.builtin.iptables:
ansible.builtin.iptables:
chain: INPUT
policy: DROP
@ -60,4 +60,4 @@
state: latest
- name: Save iptables
ansible.builtin.command: netfilter-persistent save
ansible.builtin.command: netfilter-persistent save

View file

@ -59,7 +59,7 @@
dest: /opt/nagios-plugin-bacula
- name: Copy global configuration
ansible.builtin.copy:
ansible.builtin.copy:
src: files/nagios/nagios.cfg
dest: /etc/nagios4/nagios.cfg

View file

@ -3,4 +3,3 @@
{% for command in nrpe_commands | default([]) %}
command[{{ command['name'] }}]={{ command['line'] }}
{% endfor %}