mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-09 06:46:10 +01:00
retain current content
This commit is contained in:
@@ -70,16 +70,27 @@ class CPBackupsV2:
|
|||||||
command = f'mkdir -p {self.LocalRclonePath}'
|
command = f'mkdir -p {self.LocalRclonePath}'
|
||||||
ProcessUtilities.executioner(command, self.website.externalApp)
|
ProcessUtilities.executioner(command, self.website.externalApp)
|
||||||
|
|
||||||
|
command = f'cat {self.ConfigFilePath}'
|
||||||
|
CurrentContent = ProcessUtilities.outputExecutioner(command)
|
||||||
|
|
||||||
|
if CurrentContent.find('No such file or directory'):
|
||||||
|
CurrentContent = ''
|
||||||
|
|
||||||
|
|
||||||
|
CurrentContent =
|
||||||
|
|
||||||
if type == CPBackupsV2.SFTP:
|
if type == CPBackupsV2.SFTP:
|
||||||
## config = {"name":, "host":, "user":, "port":, "path":, "password":,}
|
## config = {"name":, "host":, "user":, "port":, "path":, "password":,}
|
||||||
command = f'rclone obscure {config["password"]}'
|
command = f'rclone obscure {config["password"]}'
|
||||||
ObsecurePassword = ProcessUtilities.outputExecutioner(command).rstrip('\n')
|
ObsecurePassword = ProcessUtilities.outputExecutioner(command).rstrip('\n')
|
||||||
|
|
||||||
content = f'''[{config["name"]}]
|
content = f'''{CurrentContent}
|
||||||
|
[{config["name"]}]
|
||||||
type = sftp
|
type = sftp
|
||||||
host = {config["host"]}
|
host = {config["host"]}
|
||||||
user = {config["user"]}
|
user = {config["user"]}
|
||||||
pass = {ObsecurePassword}
|
pass = {ObsecurePassword}
|
||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
command = f"echo '{content}' > {self.ConfigFilePath}"
|
command = f"echo '{content}' > {self.ConfigFilePath}"
|
||||||
|
|||||||
Reference in New Issue
Block a user