A few more change from testing in docker

This commit is contained in:
lfield 2018-11-06 14:32:52 +00:00
parent a943a2212d
commit 01df1879aa
3 changed files with 42 additions and 32 deletions

View File

@ -145,7 +145,7 @@ class XMLConfig:
if not output:
output = open(self.filename,'w')
self.xml.writexml(output, "", " "*4, "\n")
print('', output)
output.write('')
return self
def _set_elements(self):
pass

View File

@ -237,8 +237,8 @@ def num_wus_assimilated():
def num_wus_to_transition():
return database.Workunits.count(_extra_params = ['transition_time<%d'%(time.time()+30*86400)])
def build_command_line(cmd, **kwargs):
for (key, value) in kwargs.items():
def build_command_line(cmd, kwargs):
for (key, value) in kwargs:
cmd += " -%s '%s'" %(key,value)
return cmd
@ -357,13 +357,15 @@ def install_boinc_files(dest_dir, install_web_files, install_server_files):
'tools.py',
'util.py'
])
print('''
content = '''
# Generated by make_project
import sys, os
sys.path.insert(0, os.path.join('%s', 'py'))
''' % dest_dir,
open(dest('bin', 'boinc_path_config.py'), 'w')
)
import sys, os
sys.path.insert(0, os.path.join('{dest_dir}', 'py'))
'''.format(dest_dir=dest_dir)
f = open(dest('bin', 'boinc_path_config.py'), "w")
f.write(content)
f.close()
if not install_server_files:
return
@ -582,9 +584,12 @@ class Project:
install(srcdir('test/uc_result'), self.dest('templates/uc_result'))
install(srcdir('test/uc_wu_nodelete'), self.dest('templates/uc_wu'))
content = '''
<!-- <scheduler>{url}</scheduler> -->"
<link rel=\"boinc_scheduler\" href=\"url"\">
'''.format(url=self.scheduler_url.strip())
f = open(self.dest('html/user', 'schedulers.txt'), 'w')
print("<!-- <scheduler>" + self.scheduler_url.strip() + "</scheduler> -->", f)
print("<link rel=\"boinc_scheduler\" href=\"" + self.scheduler_url.strip()+ "\">", f)
f.write(content)
f.close()
if self.no_db:
@ -598,7 +603,6 @@ class Project:
)
verbose_echo(1, "Writing config files")
self.config.write()
# create symbolic links to the CGI and HTML directories
@ -612,11 +616,14 @@ class Project:
def http_password(self, user, password):
'Adds http password protection to the html/ops directory'
passwd_file = self.dest('html/ops', '.htpassword')
content = '''
AuthName '{long_name} Administration'
AuthType Basic
AuthUserFile {passwd_file}
require valid-user
'''.format(long_name=self.long_name, passwd_file=passwd_file)
f = open(self.dest('html/ops', '.htaccess'), 'w')
print("AuthName '%s Administration'" % self.long_name, f)
print("AuthType Basic", f)
print("AuthUserFile %s" % passwd_file, f)
print("require valid-user", f)
f.write(content)
f.close()
shell_call("htpassword -bc %s %s %s" % (passwd_file, user, password))

View File

@ -336,7 +336,7 @@ httpd_conf_template_filename = os.path.join(
project_shortname+'.httpd.conf'
)
print ('''
content ='''
## Settings for BOINC project %(project_longname)s
Alias /%(project_shortname)s/download %(proot)s/download
@ -396,30 +396,32 @@ print ('''
Allow from all
</Directory>
''' %locals(),
open(httpd_conf_template_filename,'w')
)
''' % locals()
f = open(httpd_conf_template_filename,'w')
f.write(content)
f.close()
htaccess_filename = options.project_root+'/html/ops/.htaccess'
htpasswd_filename = options.project_root+'/html/ops/.htpasswd'
print('''
content = '''
AuthName "%(project_shortname)s"
AuthType Basic
AuthUserFile %(htpasswd_filename)s
require valid-user
'''%locals(),
open(htaccess_filename, 'w')
)
'''%locals()
f = open(htaccess_filename, 'w')
f.write(content)
f.close()
cronjob_filename = os.path.join(
options.project_root,
project_shortname+'.cronjob'
)
print('''0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd %(proot)s ; %(proot)s/bin/start --cron
'''%locals(),
open(cronjob_filename,'w')
)
f = open(cronjob_filename,'w')
f.write('0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd %(proot)s ; %(proot)s/bin/start --cron\n' %locals())
f.close()
readme_filename = os.path.join(
options.project_root,
@ -457,7 +459,7 @@ See the online documentation at http://boinc.berkeley.edu/
html_user_url = options.html_user_url
html_ops_url = options.html_ops_url
print('''Steps to complete installation:
content = '''Steps to complete installation:
- Change Apache configuration (as root):
@ -503,9 +505,10 @@ The project's URLs are:
Home page (and master URL): %(html_user_url)s
Administrative page: %(html_ops_url)s
%(compute_msg)s
'''%locals(),
open(readme_filename,'w')
)
'''%locals()
f = open(readme_filename,'w')
f.write(content)
f.close()
print('''
Done creating project. Please view