Skip to content

Commit

Permalink
Fix up pre-commit warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
hunger committed Dec 3, 2020
1 parent 6313b3d commit 500ea9a
Show file tree
Hide file tree
Showing 32 changed files with 73 additions and 57 deletions.
24 changes: 24 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.3.0
hooks:
- id: check-added-large-files
- id: check-byte-order-marker
- id: check-case-conflict
- id: check-executables-have-shebangs
- id: check-json
- id: check-toml
- id: check-yaml
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-added-large-files
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
- repo: https://github.com/doublify/pre-commit-rust
rev: v1.0
hooks:
- id: fmt
- id: cargo-check
- id: clippy
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
GNU General Public License
==========================

_Version 3, 29 June 2007_
_Version 3, 29 June 2007_
_Copyright © 2007 Free Software Foundation, Inc. &lt;<http://fsf.org/>&gt;_

Everyone is permitted to copy and distribute verbatim copies of this license
Expand Down
2 changes: 1 addition & 1 deletion build_container
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
from cleanroom.buildcontainer.main import run


if __name__ == '__main__':
if __name__ == "__main__":
run()
12 changes: 6 additions & 6 deletions cleanroom/commands/_create_clrm_config_initrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def _install_image_file_support(
Wants=initrd-find-image-partitions.service
Before=initrd-find-image-partitions.service shutdown.target
Conflicts=shutdown.target
[Mount]
What={image_device}
Where=/images
Expand Down Expand Up @@ -130,14 +130,14 @@ def _install_image_file_support(
BindsTo=images.mount
Requisite=images.mount
Conflicts=shutdown.target
[Service]
WorkingDirectory=/
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/losetup -P /dev/loop7 /images/{image_name}
ExecStop=/usr/bin/losetup -d /dev/loop7
[Install]
WantedBy=images.mount
"""
Expand Down Expand Up @@ -174,13 +174,13 @@ def _install_lvm_support(
BindsTo={device_name}.device
Requisite={device_name}.device
Conflicts=shutdown.target
[Service]
WorkingDirectory=/
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/partprobe /dev/{vg}/{image_name}
[Install]
WantedBy={device_name}.device
"""
Expand Down Expand Up @@ -217,7 +217,7 @@ def _install_sysroot_setup_support(
Before=initrd-parse-etc.service initrd-fs.target shutdown.target
Conflicts=shutdown.target
AssertPathExists=/etc/initrd-release
[Service]
Type=oneshot
RemainAfterExit=yes
Expand Down
2 changes: 1 addition & 1 deletion cleanroom/commands/clr_systemd_homed.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __call__(
"/usr/lib/tmpfiles.d/systemd-homed.conf",
textwrap.dedent(
"""\
C /var/lib/systemd/home - - - -
C /var/lib/systemd/home - - - -
"""
).encode("utf-8"),
mode=0o644,
Expand Down
8 changes: 4 additions & 4 deletions cleanroom/commands/k8s_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _setup_network(
f"""\
[Match]
{outside_match}
[Network]
Description=Node network
Address=10.128.{cluster_id}.{node_id}/8
Expand All @@ -71,7 +71,7 @@ def _setup_network(
f"""\
[Match]
Name=cbr0
[Network]
Description={cluster_name} pod bridge setup
Address=10.{cluster_offset}.{node_id}.1/16
Expand All @@ -87,7 +87,7 @@ def _setup_network(
f"""\
[Match]
{cluster_match}
[Network]
Description={cluster_name} pod bridge outside connectivity
Bridge=cbr0
Expand Down Expand Up @@ -159,7 +159,7 @@ def _setup_kube_proxy(
EnvironmentFile=
ExecStart=
ExecStart=/usr/bin/kube-proxy --logtostderr=true --v=0 \\
--master={master_ip}
--master={master_ip}
"""
).encode("utf-8"),
mode=0o644,
Expand Down
26 changes: 13 additions & 13 deletions cleanroom/commands/pkg_nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,39 +87,39 @@ def __call__(
"""\
user html;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
types_hash_max_size 4096;
#log_format main '$$remote_addr - $$remote_user [$$time_local] "$$request" '
# '$$status $$body_bytes_sent "$$http_referer" '
# '"$$http_user_agent" "$$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
include sites-enabled/*;
}
"""
Expand Down
14 changes: 7 additions & 7 deletions cleanroom/commands/pkg_postgresql.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,26 @@ def __call__(
textwrap.dedent(
"""\
#!/usr/bin/bash
DATADIR="$$1"
test "x$$DATADIR" = "x" && exit 2
USER=postgres
PASSWD=$$(cat /home/postgres/.pgpass | cut -d':' -f5)
if test ! -d "$${DATADIR}" ; then
su $${USER} -c "/usr/bin/initdb -D $${DATADIR} --encoding UTF8 --locale C" || exit 1
su $${USER} -c "/usr/bin/postgres --single -D $${DATADIR}" <<EOF > /dev/null 2>&1
ALTER USER $${USER} PASSWORD "$${PASSWD}";
EOF
echo >> "$${DATADIR}/postgresql.conf"
echo "listen_addresses = '*' # Listen everywhere!" >> "$${DATADIR}/postgresql.conf"
cat << END_OF_CONFIG > "$${DATADIR}/pg_hba.conf"
# TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all md5
# IPv4 local connections:
Expand Down
2 changes: 1 addition & 1 deletion cleanroom/commands/pkg_systemd_homed.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __call__(
"/usr/lib/tmpfiles.d/systemd-homed.conf",
textwrap.dedent(
"""\
C /var/lib/systemd/home - - - -
C /var/lib/systemd/home - - - -
"""
).encode("utf-8"),
mode=0o644,
Expand Down
4 changes: 2 additions & 2 deletions cleanroom/commands/pkg_tmux.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ def __call__(
# Last window on C-a C-a:
bind-key C-a last-window
# Highlight active window
set-window-option -g window-status-current-bg red
# Set window notifications
setw -g monitor-activity on
set -g visual-activity on
Expand Down
2 changes: 1 addition & 1 deletion cleanroom/helper/archlinux/iptables.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def _install_v4_rules(
:TCP - [0:0]
:UDP - [0:0]
:LOGDROP - [0:0]
-A LOGDROP -m limit --limit 5/m --limit-burst 10 -j LOG
-A LOGDROP -j DROP
Expand Down
2 changes: 1 addition & 1 deletion clrm
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
import cleanroom.main as main


if __name__ == '__main__':
if __name__ == "__main__":
main.run()
1 change: 0 additions & 1 deletion examples/system-example-desktop.def
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,3 @@ create /etc/modules-load.d/bluetooth.conf <<<<btusb
# Export a image:
## This will run create_image and export the result into the provided borg repository:
export borg_repository

1 change: 0 additions & 1 deletion examples/tests/000-filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ function fail {
test -c "dev/null" || fail "/dev/null is missing or no char device."

echo "Devices look sane, ok"

1 change: 0 additions & 1 deletion examples/tests/001-root-password
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ grep '^root:[x!]?:' etc/shadow && fail "No root password set in /etc/shadow, fai
grep ':\\\$' etc/shadow && fail "Broken password set in /etc/shadow, fail", 2

echo "Root password set in /etc/shadow, ok"

1 change: 0 additions & 1 deletion examples/tests/002-systemd-users
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ function fail {
grep '^systemd-resolve:x:' etc/passwd || fail "No system-resolve user set in /etc/passwd, fail", 1

echo "systemd-resolve user found in /etc/passwd, ok"

1 change: 0 additions & 1 deletion examples/tests/005-etc-systemd
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ test -z "$(ls -A etc/systemd/system)" \
|| fail "/etc/systemd/system is not empty, fail" 1

echo "/etc/systemd is empty, ok"

1 change: 0 additions & 1 deletion examples/tests/006-var-lib-pacman
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ function fail {
test -d var/lib/pacman && fail "/var/lib/pacman exists, fail" 1

echo "No /var/lib/pacman, ok"

1 change: 0 additions & 1 deletion examples/tests/050-locale
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ grep "^LC_MESSAGES=en_US" etc/locale.conf > /dev/null \
|| fail "LC_MESSAGES not set up in /etc/locale.conf" 2

echo "Locale has been set up, ok"

3 changes: 1 addition & 2 deletions examples/tests/060-systemd-usr-links
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SD="${TOP}/usr/lib/systemd/system"
for L in $(cd "${SD}" ; find . -type l) ; do
LT=$(cd "${SD}" && readlink "${L}" | sed -e 's!^\./!!')
if test "x$LT" = "x/dev/null" ; then
echo "Systemd: Symlink ${L} is a mask, ok."
echo "Systemd: Symlink ${L} is a mask, ok."
elif [[ "$(dirname "${L}")" == "." ]]; then
# top level:
if [[ "${LT}" != */* ]]; then
Expand All @@ -28,4 +28,3 @@ for L in $(cd "${SD}" ; find . -type l) ; do
fi
fi
done

1 change: 0 additions & 1 deletion examples/tests/065-systemd-usr-perms
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,3 @@ for F in $(cd "${SD}" ; find . -type f) ; do
done

echo "Systemd unit permissions ok."

1 change: 0 additions & 1 deletion examples/tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@
# * SYSTEM_NAME
# * BASE_SYSTEM_NAME
# * ROOT

1 change: 0 additions & 1 deletion examples/type-baremetal.def
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,3 @@ systemd_enable fstrim.timer smartd.service tlp.service
# This conflicts with tlp:
remove /usr/lib/systemd/system/systemd-rfkill.service
/usr/lib/systemd/system/systemd-rfkill.socket

1 change: 0 additions & 1 deletion examples/type-base.def
Original file line number Diff line number Diff line change
Expand Up @@ -120,4 +120,3 @@ add_hook export

# root password is 'root'
usermod root password='$$6$$vQcfU8MejvgmkP0w$$8NJw8S9/5LKwPQQcFTM46E3OkFjy9Xw8FNK19etphO6XlC.gkNn/voQqEHqlUtTrhGvoLBMVMlXpfRpFKE.aX/'

1 change: 0 additions & 1 deletion examples/type-base/pacstrap.conf
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,3 @@ Server = ftp://ftp.archlinux.org/$repo/os/$arch
#[multilib]
#Server = http://ftp5.gwdg.de/pub/linux/archlinux/$repo/os/$arch
#Server = ftp://ftp.archlinux.org/$repo/os/$arch

2 changes: 1 addition & 1 deletion firestarter
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
from cleanroom.firestarter.main import run


if __name__ == '__main__':
if __name__ == "__main__":
run()
Empty file modified tests/conftest.py
100755 → 100644
Empty file.
3 changes: 2 additions & 1 deletion tests/test_commands.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# #!/usr/bin/python
#!/usr/bin/python

# """Test for the built-in print_commands of cleanroom.
#
# @author: Tobias Hunger <[email protected]>
Expand Down
3 changes: 2 additions & 1 deletion tests/test_helper_file.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# #!/usr/bin/python
#!/usr/bin/python

# """Test for the file helper module.
#
# @author: Tobias Hunger <[email protected]>
Expand Down
1 change: 1 addition & 0 deletions tests/test_helper_group.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
"""Test for the cleanroom.generator.helper.generic.group
Expand Down
3 changes: 2 additions & 1 deletion tests/test_helper_iptables.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# #!/usr/bin/python
#!/usr/bin/python

# """Test for the built-in print_commands of cleanroom.
#
# @author: Tobias Hunger <[email protected]>
Expand Down
3 changes: 2 additions & 1 deletion tests/test_helper_user.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# # -*- coding: utf-8 -*-
#!/usr/bin/python
# -*- coding: utf-8 -*-
# """Test for the cleanroom.generator.helper.generic.user
#
# @author: Tobias Hunger <[email protected]>
Expand Down

0 comments on commit 500ea9a

Please sign in to comment.