remove irrelevant os.path.exists() checks
This commit is contained in:
parent
5d4d2d6a62
commit
f699f5fe31
|
@ -2,8 +2,6 @@ from pyinfra import host
|
||||||
from pyinfra.operations import apt, server, files
|
from pyinfra.operations import apt, server, files
|
||||||
from pyinfra.facts.server import LinuxName
|
from pyinfra.facts.server import LinuxName
|
||||||
|
|
||||||
import os
|
|
||||||
|
|
||||||
files_path = "files/matrix-synapse/"
|
files_path = "files/matrix-synapse/"
|
||||||
|
|
||||||
## don't exexute on a local mashine
|
## don't exexute on a local mashine
|
||||||
|
@ -95,15 +93,11 @@ if host.name != "@local":
|
||||||
|
|
||||||
## copy doas config
|
## copy doas config
|
||||||
doas_conf_path = files_path +"doas.conf"
|
doas_conf_path = files_path +"doas.conf"
|
||||||
exi = os.path.exists(doas_conf_path)
|
files.put(
|
||||||
if exi == True:
|
name="copy doas config",
|
||||||
files.put(
|
src=doas_conf_path,
|
||||||
name="copy doas config",
|
dest="/etc/doas.conf",
|
||||||
src=doas_conf_path,
|
)
|
||||||
dest="/etc/doas.conf",
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
print("file: \"" +doas_conf_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## generate synapse config
|
## generate synapse config
|
||||||
server.shell(
|
server.shell(
|
||||||
|
@ -135,39 +129,27 @@ if host.name != "@local":
|
||||||
|
|
||||||
## copy synapse config
|
## copy synapse config
|
||||||
homeserver_py_path = files_path +"homeserver.yaml"
|
homeserver_py_path = files_path +"homeserver.yaml"
|
||||||
exi = os.path.exists(homeserver_py_path)
|
files.put(
|
||||||
if exi == True:
|
name="copy synapse config",
|
||||||
files.put(
|
src=homeserver_py_path,
|
||||||
name="copy synapse config",
|
dest="/var/synapse/homeserver.yaml",
|
||||||
src=homeserver_py_path,
|
)
|
||||||
dest="/var/synapse/homeserver.yaml",
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
print("file: \"" +homeserver_py_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## copy logging config
|
## copy logging config
|
||||||
log_conf_path = files_path + "chat.heizhaus.org.log.config"
|
log_conf_path = files_path + "chat.heizhaus.org.log.config"
|
||||||
exi = os.path.exists(log_conf_path)
|
files.put(
|
||||||
if exi == True:
|
name="copy logging config",
|
||||||
files.put(
|
src=log_conf_path,
|
||||||
name="copy logging config",
|
dest="/var/synapse/chat.heizhaus.org.log.config",
|
||||||
src=log_conf_path,
|
)
|
||||||
dest="/var/synapse/chat.heizhaus.org.log.config",
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
print("file: \"" +log_conf_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## add synapse commands to PATH
|
## add synapse commands to PATH
|
||||||
dotprofile_path = files_path +"dotprofile"
|
dotprofile_path = files_path +"dotprofile"
|
||||||
exi = os.path.exists(dotprofile_path)
|
files.put(
|
||||||
if exi == True:
|
name="add synapse commands to PATH",
|
||||||
files.put(
|
src=dotprofile_path,
|
||||||
name="add synapse commands to PATH",
|
dest="/root/.profile",
|
||||||
src=dotprofile_path,
|
)
|
||||||
dest="/root/.profile",
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
print("file: \"" +dotprofile_path +"\" dosn't exists")
|
|
||||||
|
|
||||||
## change owner for /var/synapse
|
## change owner for /var/synapse
|
||||||
# user_name = "_synapse"
|
# user_name = "_synapse"
|
||||||
|
@ -204,12 +186,8 @@ if host.name != "@local":
|
||||||
|
|
||||||
## add synapse backup script
|
## add synapse backup script
|
||||||
backup_sh_path = files_path +"borgbackup.sh"
|
backup_sh_path = files_path +"borgbackup.sh"
|
||||||
exi = os.path.exists(backup_sh_path)
|
files.put(
|
||||||
if exi == True:
|
name="add synapse backup script",
|
||||||
files.put(
|
src=backup_sh_path,
|
||||||
name="add synapse backup script",
|
dest="/etc/daily.d/borgbackup.sh"
|
||||||
src=backup_sh_path,
|
)
|
||||||
dest="/etc/daily.d/borgbackup.sh"
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
print("file: \"" +backup_sh_path +"\" dosn't exists")
|
|
||||||
|
|
Loading…
Reference in a new issue