def GetSlivers(data, config=None, plc=None):
logger.log("conf_files: Running.")
- instance = conf_files()
+ instance = ConfFiles()
instance.run_once(data)
logger.log("conf_files: Done.")
trigger=time.time()+timeout
result = False
try:
- child = subprocess.Popen(command, bufsize=1,
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
+ child = subprocess.Popen(
+ command, bufsize=1,
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ close_fds=True,
+ universal_newlines=True)
buffer = Buffer()
while True:
# see if anything can be read within the poll interval
logger.verbose("log_call: poll=%r s" % poll)
trigger=time.time()+timeout
try:
- child = subprocess.Popen(command, bufsize=1,
- stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
+ child = subprocess.Popen(
+ command, bufsize=1,
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ close_fds=True,
+ universal_newlines=True)
stdout = ""
while True:
# this assumes the reference image is in its own subvolume
command = ['btrfs', 'subvolume', 'snapshot', refImgDir, containerDir]
if not logger.log_call(command, timeout=BTRFS_TIMEOUT):
- logger.log('sliver_lxc: ERROR Could not create BTRFS snapshot at', containerDir)
+ logger.log('sliver_lxc: ERROR Could not create BTRFS snapshot at {}'
+ .format(containerDir))
return
command = ['chmod', '755', containerDir]
logger.log_call(command)
# overwrite target file: create a temp in the same directory
path = os.path.dirname(target) or '.'
fd, name = tempfile.mkstemp('', 'repl', path)
- os.write(fd, new_contents)
+ os.write(fd, new_contents.encode())
os.close(fd)
if os.path.exists(target):
os.unlink(target)