Loading cloudcontrol/node/host/__init__.py +14 −1 Original line number Diff line number Diff line Loading @@ -7,9 +7,11 @@ import subprocess import logging import os.path import stat import shutil import struct import socket import termios import tempfile from fcntl import ioctl from itertools import chain, imap from subprocess import Popen, PIPE, STDOUT Loading Loading @@ -204,7 +206,18 @@ class Handler(BasePlugin): #: loaded plugins self.plugins = {} # plugin name -> plugin object #: cache directory for scripts try: self.scripts_dir = tempfile.mkdtemp(prefix='cc-node-script-cache') except EnvironmentError as e: logger.critical('Cannot create temporary directory for scripts: %s', e.strerror) self.main.stop() raise def stop(self): # remove script cache directory shutil.rmtree(self.scripts_dir, ignore_errors=True) # kill all currently running shells for shell in self.shells.values(): try: Loading Loading @@ -296,7 +309,7 @@ class Handler(BasePlugin): @pass_connection def script_run(self, conn, sha1, script, owner, *args): # retrive script if not here filename = '/tmp/cc-node-scripts/' + sha1 filename = os.path.join(self.scripts_dir, sha1) if not os.access(filename, os.X_OK): try: sha1, content = conn.call('script_get', script) Loading Loading
cloudcontrol/node/host/__init__.py +14 −1 Original line number Diff line number Diff line Loading @@ -7,9 +7,11 @@ import subprocess import logging import os.path import stat import shutil import struct import socket import termios import tempfile from fcntl import ioctl from itertools import chain, imap from subprocess import Popen, PIPE, STDOUT Loading Loading @@ -204,7 +206,18 @@ class Handler(BasePlugin): #: loaded plugins self.plugins = {} # plugin name -> plugin object #: cache directory for scripts try: self.scripts_dir = tempfile.mkdtemp(prefix='cc-node-script-cache') except EnvironmentError as e: logger.critical('Cannot create temporary directory for scripts: %s', e.strerror) self.main.stop() raise def stop(self): # remove script cache directory shutil.rmtree(self.scripts_dir, ignore_errors=True) # kill all currently running shells for shell in self.shells.values(): try: Loading Loading @@ -296,7 +309,7 @@ class Handler(BasePlugin): @pass_connection def script_run(self, conn, sha1, script, owner, *args): # retrive script if not here filename = '/tmp/cc-node-scripts/' + sha1 filename = os.path.join(self.scripts_dir, sha1) if not os.access(filename, os.X_OK): try: sha1, content = conn.call('script_get', script) Loading