- add a new disallow_redirect parameter, that makes urlFetcher.download() to return an error in case of URL redirects - enable disallow_redirect when downloading repository data (RepoInterface.run_sync()) - avoid to return an error if urlFetcher.download() fails due to issues with our custom User-Agent when downloading from HTTP Entropy/Socket Services: - create a parent class SocketCommandsSkel which acts as skeleton to any SocketHostInterface command class, this avoids having to declare register() matching a proper signature not even documented (until this commit) - some slight fixes/updates in the BasicPamAuthenticator class, change docmd_userdata() API removing unneeded parameters - make BuiltInCommands class a subclass of SocketCommandsSkel and remove register() since it's now inherited - get_new_session() now creates 4 more keys in the session dictionary for easy reference: admin, moderator, user, developer indicating the post-authentication user level Entropy/phpbb3Authenticator: - update API to reflect the changes in SocketHostInterface Entropy/Repository Services interface: - add a new commands class (phpbb3Commands) that can be used to extend functionalities when using the phpbb3 authenticator Entropy/Electron: - more preliminary work on the login and widgets Entropy/RepositoryCommands: - make it a subclass of SocketCommandsSkel too Entropy/RepositorySocketServerInterface: - make external_cmd_classes keyword argument to work correctly - update get_logged_user_data() to reflect changes in server API - add 3 new functions (self explanatory): is_administrator(), is_moderator(), is_developer(), is_user() git-svn-id: http://svn.sabayonlinux.org/projects/entropy/trunk@2248 cd1c1023-2f26-0410-ae45-c471fc1f0318
85 lines
2.3 KiB
Python
85 lines
2.3 KiB
Python
#!/usr/bin/python
|
|
import sys, time
|
|
sys.path.insert(0,'/usr/lib/entropy/libraries')
|
|
sys.path.insert(0,'/usr/lib/entropy/client')
|
|
sys.path.insert(0,'../libraries')
|
|
sys.path.insert(0,'../client')
|
|
# disable pid management
|
|
sys.argv.append("--no-pid-handling")
|
|
do_ssl = False
|
|
do_stdout_logging = True
|
|
if "--ssl" in sys.argv:
|
|
do_ssl = True
|
|
if "--nostdout" in sys.argv:
|
|
do_stdout_logging = False
|
|
|
|
import entropyTools, exceptionTools
|
|
from entropy import RepositorySocketServerInterface, phpBB3AuthInterface, phpbb3Authenticator, phpbb3Commands
|
|
|
|
|
|
connection_data = {
|
|
'hostname': 'localhost',
|
|
'port': 3306,
|
|
'username': 'phpbb_user',
|
|
'password': 'mypassword',
|
|
'dbname': 'phpbb_db'
|
|
}
|
|
|
|
# configure my repositories
|
|
repositories = {
|
|
('sabayonlinux.org','amd64','standard',): {
|
|
'dbpath': '/home/fabio/new.sabayonlinux.org/standard/amd64',
|
|
'cmethod': 'bz2',
|
|
},
|
|
}
|
|
|
|
def run_srv(s):
|
|
try:
|
|
s.go()
|
|
except (KeyboardInterrupt, SystemExit,):
|
|
s.killall()
|
|
|
|
sock_auth = (phpbb3Authenticator,[],connection_data)
|
|
srv_ssl = None
|
|
srv = RepositorySocketServerInterface(
|
|
do_ssl = False,
|
|
repositories = repositories,
|
|
stdout_logging = do_stdout_logging,
|
|
sock_auth = sock_auth,
|
|
external_cmd_classes = [phpbb3Commands]
|
|
)
|
|
if do_ssl:
|
|
srv_ssl = RepositorySocketServerInterface(
|
|
do_ssl = True,
|
|
repositories = repositories,
|
|
stdout_logging = do_stdout_logging,
|
|
sock_auth = sock_auth,
|
|
external_cmd_classes = [phpbb3Commands]
|
|
)
|
|
|
|
task = entropyTools.parallelTask(run_srv, srv)
|
|
task.setName('repodaemon')
|
|
task.start()
|
|
if srv_ssl != None:
|
|
task = entropyTools.parallelTask(run_srv, srv_ssl)
|
|
task.setName('repodaemon_ssl')
|
|
task.start()
|
|
|
|
while 1:
|
|
try:
|
|
time.sleep(1)
|
|
found = False
|
|
threads = entropyTools.threading.enumerate()
|
|
for thread in threads:
|
|
if thread.getName() in ["repodaemon","repodaemon_ssl"]:
|
|
found = True
|
|
break
|
|
if not found:
|
|
break
|
|
except (KeyboardInterrupt, SystemExit,):
|
|
threads = entropyTools.threading.enumerate()
|
|
for thread in threads:
|
|
if thread.getName() in ["repodaemon","repodaemon_ssl"]:
|
|
thread.args[0].killall()
|
|
raise SystemExit
|