2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-22 09:32:21 +00:00

Start browserfs if not yet running

This commit is contained in:
Jarrod Johnson 2024-01-26 09:31:59 -05:00
parent fa3e1202c4
commit 87454c1ab1
2 changed files with 21 additions and 0 deletions

View File

@ -1,9 +1,27 @@
import eventlet
import confluent.messages as msg
import confluent.exceptions as exc
import struct
import eventlet.green.socket as socket
import eventlet.green.subprocess as subprocess
import os
mountsbyuser = {}
_browserfsd = None
def assure_browserfs():
global _browserfsd
if _browserfsd is None:
os.makedirs('/var/run/confluent/browserfs/mount', exist_ok=True)
_browserfsd = subprocess.Popen(
['/opt/confluent/bin/browserfs',
'-c', '/var/run/confluent/browserfs/control',
'-s', '127.0.0.1:4006',
# browserfs supports unix domain websocket, however apache reverse proxy is dicey that way in some versions
'-w', '/var/run/confluent/browserfs/mount'])
while not os.path.exists('/var/run/confluent/browserfs/control'):
eventlet.sleep(0.5)
def handle_request(configmanager, inputdata, pathcomponents, operation):
curruser = configmanager.current_user
@ -33,6 +51,7 @@ def handle_request(configmanager, inputdata, pathcomponents, operation):
})
def requestmount(subdir, filename):
assure_browserfs()
a = socket.socket(socket.AF_UNIX)
a.connect('/var/run/confluent/browserfs/control')
subname = subdir.encode()
@ -57,3 +76,4 @@ def requestmount(subdir, filename):
'authtoken': authtok
}
return thismount

View File

@ -88,6 +88,7 @@ manuallicenses = [
'/usr/share/licenses/sqlite/LICENSE.md', # https://raw.githubusercontent.com/sqlite/sqlite/master/LICENSE.md
'/usr/share/licenses/pcre2/LICENSE.BSD2',
'/usr/share/licenses/dhcp-common/NOTICE',
'/usr/share/licenses/xz/COPYING.GPLv3', # manually extracted from xz source
'/usr/share/licenses/bash/NOTICE',
'/usr/share/licenses/libsepol/NOTICE',
'/usr/share/licenses/perl/COPYING.regexec', # regexec.c