Compare commits
3 Commits
e692c4df18
...
9492a1d087
Author | SHA1 | Date | |
---|---|---|---|
9492a1d087 | |||
3f1155393b | |||
6bd216615d |
@ -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):
|
|
||||||
permission = 755
|
|
||||||
self.run_command(f"chmod -R {permission} {destination}", return_status_code=True)
|
self.run_command(f"chmod -R {permission} {destination}", return_status_code=True)
|
||||||
else:
|
else:
|
||||||
permission = 644
|
|
||||||
self.run_command(f"chmod {permission} {destination}", return_status_code=True)
|
self.run_command(f"chmod {permission} {destination}", return_status_code=True)
|
||||||
else:
|
|
||||||
raise NotImplementedError("Permission setting is only supported for LXC machines")
|
|
||||||
|
|
||||||
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:
|
else:
|
||||||
self.run_command(f"chown {owner} {destination}", return_status_code=True)
|
self.run_command(f"chown {owner} {destination}", return_status_code=True)
|
||||||
else:
|
|
||||||
raise NotImplementedError("Owner setting is only supported for LXC machines")
|
|
||||||
|
|
||||||
|
@ -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}")
|
||||||
|
@ -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']:
|
||||||
|
Loading…
Reference in New Issue
Block a user