Compare commits

...

3 Commits

Author SHA1 Message Date
9492a1d087
update seafile install script and add warning global param
All checks were successful
continuous-integration/drone/push Build is passing
2023-06-23 11:48:01 +02:00
3f1155393b
fixed permissions with move step 2023-06-23 11:00:46 +02:00
6bd216615d
use test command to detect if folder 2023-06-23 10:46:59 +02:00
3 changed files with 12 additions and 16 deletions

View File

@ -345,26 +345,20 @@ class LinuxMachine:
self.run_command(machine_utils.get_services_command(self.get_os_name(), "disable", service), self.run_command(machine_utils.get_services_command(self.get_os_name(), "disable", service),
return_status_code=True) return_status_code=True)
def is_folder(self, path: str) -> bool:
self.run_command(f"test -d {path}", return_status_code=True)
def move(self, source, destination, permission: int = None, owner: str = "root"): def move(self, source, destination, permission: int = None, owner: str = "root"):
self.run_command(f"mv {source} {destination}", return_status_code=True) self.run_command(f"mv {source} {destination}", return_status_code=True)
if permission is not None: if permission is not None:
if "LXC" in str(self.__class__): if self.is_folder(source):
if self.pve.connection.sftp().is_remote_dir(source): self.run_command(f"chmod -R {permission} {destination}", return_status_code=True)
permission = 755
self.run_command(f"chmod -R {permission} {destination}", return_status_code=True)
else:
permission = 644
self.run_command(f"chmod {permission} {destination}", return_status_code=True)
else: else:
raise NotImplementedError("Permission setting is only supported for LXC machines") self.run_command(f"chmod {permission} {destination}", return_status_code=True)
if owner != "root": if owner != "root":
if "LXC" in str(self.__class__): if self.is_folder(source):
if self.pve.connection.sftp().is_remote_dir(source): self.run_command(f"chown -R {owner} {destination}", return_status_code=True)
self.run_command(f"chown -R {owner} {destination}", return_status_code=True)
else:
self.run_command(f"chown {owner} {destination}", return_status_code=True)
else: else:
raise NotImplementedError("Owner setting is only supported for LXC machines") self.run_command(f"chown {owner} {destination}", return_status_code=True)

View File

@ -53,3 +53,4 @@ def launch_lxc(lxc):
lxc.create() lxc.create()
lxc.start() lxc.start()
lxc.run_creation() lxc.run_creation()
logging.info(f"Finished loading LXC {lxc.id}")

View File

@ -138,7 +138,8 @@ def run_steps(linux_machine: LinuxMachine, steps: dict):
f"skipping...") f"skipping...")
continue continue
logging.info(f"Running step {index + 1}/{len(steps)} for LXC {linux_machine.id}...") logging.info(
f"Running step {index + 1}/{len(steps)} for LXC {linux_machine.id}...\n {step['warning'] if 'warning' in step else ''}")
# Run command step # Run command step
match step['type']: match step['type']: