Commit 4bba2629 by Oliver Pinter

use absolute path in call()s

parent cefb7c9e
...@@ -12,9 +12,9 @@ working_directory = sys.path[0] ...@@ -12,9 +12,9 @@ working_directory = sys.path[0]
try: try:
# load virtio console driver, the device is /dev/ttyV0.1 # load virtio console driver, the device is /dev/ttyV0.1
subprocess.call(('kldload', '-n', 'virtio_console')) subprocess.call(('/sbin/kldload', '-n', 'virtio_console'))
chdir(working_directory) chdir(working_directory)
subprocess.call(('pip', 'install', '-r', 'requirements.txt')) subprocess.call(('/usr/local/bin/pip', 'install', '-r', 'requirements.txt'))
copy("/root/agent/misc/vm_renewal", "/usr/local/bin/") copy("/root/agent/misc/vm_renewal", "/usr/local/bin/")
except: except:
pass # hope it works pass # hope it works
...@@ -90,7 +90,7 @@ class Context(BaseContext): ...@@ -90,7 +90,7 @@ class Context(BaseContext):
@staticmethod @staticmethod
def restart_networking(): def restart_networking():
subprocess.call(['/sbin/service', 'netif', 'restart']) subprocess.call(['/usr/sbin/service', 'netif', 'restart'])
@staticmethod @staticmethod
def change_ip(interfaces, dns): def change_ip(interfaces, dns):
...@@ -129,7 +129,7 @@ class Context(BaseContext): ...@@ -129,7 +129,7 @@ class Context(BaseContext):
with open('/etc/fstab', 'a') as f: with open('/etc/fstab', 'a') as f:
f.write(mount_template_linux % data) f.write(mount_template_linux % data)
subprocess.call('mount -a', shell=True) subprocess.call('/sbin/mount -a', shell=True)
@staticmethod @staticmethod
def get_keys(): def get_keys():
...@@ -197,10 +197,7 @@ class Context(BaseContext): ...@@ -197,10 +197,7 @@ class Context(BaseContext):
@staticmethod @staticmethod
def start_access_server(): def start_access_server():
try: subprocess.call(('/usr/sbin/service', 'ssh', 'start'))
subprocess.call(('/sbin/start', 'ssh'))
except OSError:
subprocess.call(('/bin/systemctl', 'start', 'sshd.service'))
@staticmethod @staticmethod
def append(data, filename, chunk_number, uuid): def append(data, filename, chunk_number, uuid):
......
...@@ -88,7 +88,7 @@ def change_ip_freebsd(interfaces, dns): ...@@ -88,7 +88,7 @@ def change_ip_freebsd(interfaces, dns):
'gw': conf['gw6' if ip.version == 6 else 'gw4'], 'gw': conf['gw6' if ip.version == 6 else 'gw4'],
'dns': dns}) 'dns': dns})
for ifname, conf in data: for ifname, conf in data:
subprocess.call(('/sbin/ifup', ifname)) subprocess.call(('/usr/sbin/service', 'netif', 'start', ifname))
# example: # example:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment