File tree Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ pull_request :
5+ push :
6+ branches :
7+ - main
8+
9+ jobs :
10+ python :
11+ name : Lint Python
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v3
15+ - name : Install black
16+ run : pip install ruff
17+ - name : Check style
18+ run : ruff format --quiet --line-length 120 --diff */*.py *.py
19+ - name : Lint
20+ run : ruff check */*.py *.py
Original file line number Diff line number Diff line change @@ -56,9 +56,7 @@ def deploy_borgbackup(
5656 if borg_repo .startswith ("hetzner-backup:" ):
5757 files .put (
5858 name = "create SSH config" ,
59- src = importlib .resources .files (__package__ )
60- .joinpath ("dot_ssh" , "config" )
61- .open ("rb" ),
59+ src = importlib .resources .files (__package__ ).joinpath ("dot_ssh" , "config" ).open ("rb" ),
6260 dest = "/root/.ssh/config" ,
6361 user = "root" ,
6462 group = "root" ,
@@ -113,8 +111,8 @@ def deploy_borgbackup(
113111 src = importlib .resources .files (__package__ ).joinpath ("borgbackup.timer.j2" ),
114112 dest = "/etc/systemd/system/borgbackup.timer" ,
115113 mode = "644" ,
116- minute = str (random .randint (0 , 59 )),
117- hour = str (random .randint (0 , 4 )),
114+ minute = str (random .randint (0 , 59 )),
115+ hour = str (random .randint (0 , 4 )),
118116 )
119117 systemd .service (
120118 name = "Setup borgbackup timer" ,
Original file line number Diff line number Diff line change 55
66
77def cmd (command : str ) -> int :
8- """Run a command and return its exit code. """
8+ """Run a command and return its exit code."""
99 return os .waitstatus_to_exitcode (os .system (command ))
1010
1111
@@ -27,8 +27,6 @@ def cmd(command: str) -> int:
2727 if user == "root" :
2828 returncode = cmd (f"systemctl { args .command } { services [user ]} " )
2929 else :
30- returncode = cmd (
31- f"su -l { user } -c 'systemctl --user { args .command } { services [user ]} '"
32- )
30+ returncode = cmd (f"su -l { user } -c 'systemctl --user { args .command } { services [user ]} '" )
3331 if returncode != 0 :
3432 print (f"WARNING: Failed to { args .command } { services [user ]} as { user } user" )
You can’t perform that action at this time.
0 commit comments