Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 541 lines (399 sloc) 17.065 kb
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
1 # -*- coding: utf-8; mode: python -*-
2 #
3 # Cherokee-admin
4 #
5 # Authors:
6 # Alvaro Lopez Ortega <alvaro@alobbs.com>
7 #
8 # Copyright (C) 2001-2011 Alvaro Lopez Ortega
9 #
10 # This program is free software; you can redistribute it and/or
11 # modify it under the terms of version 2 of the GNU General Public
12 # License as published by the Free Software Foundation.
13 #
14 # This program is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License
20 # along with this program; if not, write to the Free Software
21 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 # 02110-1301, USA.
23 #
24
25 import os
26 import time
27 import CTK
28 import validations
29 import CommandProgress
30
31 from configured import *
32
33
34 CFG_PREFIX = "tmp!wizard"
35
36 VALIDATION = [
37 ('%s!vserver_nick'%(CFG_PREFIX), validations.is_not_empty),
38 ]
39
40 #
41 # Phase's base
42 #
43
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
44 class Phase (CTK.Box):
45 def __init__ (self, title):
46 CTK.Box.__init__ (self)
47 self.title = title
48 self.built = False
49
50 def Render (self):
51 if not self.built:
52 self.built = True
53 self += CTK.RawHTML ('<h2>%s</h2>' %(_(self.title)))
54 if hasattr (self, '__build_GUI__'):
55 self.__build_GUI__()
56
57 return CTK.Box.Render (self)
58
59 def __call__ (self):
60 return self.Render().toStr()
61
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
62 class Phase_Next (Phase):
63 def __init__ (self, title):
64 Phase.__init__ (self, title)
65 self.buttons_added = False
66
67 def Render (self):
68 if not self.buttons_added:
69 self.buttons_added = True
70 self += CTK.DruidButtonsPanel_Next_Auto()
71
72 return Phase.Render(self)
73
74 class Phase_Cancel (Phase):
45081c4 @alobbs WIP: Final stage
alobbs authored
75 def __init__ (self, title):
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
76 Phase.__init__ (self, title)
45081c4 @alobbs WIP: Final stage
alobbs authored
77 self.buttons_added = False
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
78
79 def Render (self):
80 if not self.buttons_added:
81 self.buttons_added = True
45081c4 @alobbs WIP: Final stage
alobbs authored
82 self += CTK.DruidButtonsPanel_Cancel()
83
84 return Phase.Render(self)
85
86 class Phase_Close (Phase):
87 def __init__ (self, title):
88 Phase.__init__ (self, title)
89 self.buttons_added = False
90
91 def Render (self):
92 if not self.buttons_added:
93 self.buttons_added = True
94 self += CTK.DruidButtonsPanel_Close()
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
95
96 return Phase.Render(self)
97
98 class Phase_PrevNext (Phase):
99 def __init__ (self, title):
100 Phase.__init__ (self, title)
101 self.buttons_added = False
102
103 def Render (self):
104 if not self.buttons_added:
105 self.buttons_added = True
106 self += CTK.DruidButtonsPanel_PrevNext_Auto()
107
108 return Phase.Render(self)
109
110
111 #
112 # Stages
113 #
114
115 class Phase_Welcome (Phase_Next):
116 def __init__ (self, wizard, install_type):
117 Phase_Next.__init__ (self, "Welcome to the %s Wizard"%(wizard))
118
119 # Clean up previous wizard info
120 del (CTK.cfg[CFG_PREFIX])
121
122 # Set installation type
123 CTK.cfg['%s!type'%(CFG_PREFIX)] = install_type
124
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
125 def __build_GUI__ (self):
126 self += CTK.RawHTML ('Welcome!')
127
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
128
129 #
130 # Enter Virtual Server
131 #
132
133 NOTE_VSERVER = N_("Domain name of the Virtual Host you are about to create. Wildcards are allowed. For example: *.example.com")
134
135 class Stage_Enter_VServer (Phase_PrevNext):
136 class Apply:
137 def __call__ (self):
138 return CTK.cfg_apply_post()
139
140 def __init__ (self):
141 Phase_PrevNext.__init__ (self, _("Name of the new Virtual Server"))
142
143 def __build_GUI__ (self):
144 table = CTK.PropsTable()
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
145 table.Add (_('Domain Name'), CTK.TextCfg('%s!vserver_nick'%(CFG_PREFIX), False, {'class':'noauto'}), _(NOTE_VSERVER))
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
146
147 box = CTK.Box ({'class': 'market-target-selection'})
148
149 submit = CTK.Submitter (URL_STAGE_ENTER_VSERVER_APPLY)
150 submit.bind ('submit_success', CTK.DruidContent__JS_to_goto_next (box.id))
151 submit += table
152
153 box += submit
154 self += box
155
156 URL_STAGE_ENTER_VSERVER = "/wizard2/stages/enter_vserver"
157 URL_STAGE_ENTER_VSERVER_APPLY = "/wizard2/stages/enter_vserver/apply"
158
159 CTK.publish ('^%s'%(URL_STAGE_ENTER_VSERVER), Stage_Enter_VServer)
160 CTK.publish ('^%s'%(URL_STAGE_ENTER_VSERVER_APPLY), Stage_Enter_VServer.Apply, validation=VALIDATION, method="POST")
161
162
163 #
164 # Virtual Server Logging
165 #
166
167 LOGGING_OPTIONS = [
168 ('', N_('No logging')),
169 ('copy', N_('Copy from default'))
170 ]
171
172 class Stage_VServer_Logging (Phase_PrevNext):
173 class Apply:
174 def __call__ (self):
175 return CTK.cfg_apply_post()
176
177 def __init__ (self):
178 Phase_PrevNext.__init__ (self, _("Logging Configuration"))
179
180 def __build_GUI__ (self):
181 submit = CTK.Submitter (URL_STAGE_VSERVER_LOGGING_APPLY)
182 submit += CTK.RadioGroupCfg ('%s!logging'%(CFG_PREFIX), LOGGING_OPTIONS, {'checked': LOGGING_OPTIONS[0][0]})
183
184 box = CTK.Box()
185 box += submit
186 self += box
187
188 URL_STAGE_VSERVER_LOGGING = "/wizard2/stages/vserver_logging"
189 URL_STAGE_VSERVER_LOGGING_APPLY = "/wizard2/stages/vserver_logging/apply"
190
191 CTK.publish ('^%s'%(URL_STAGE_VSERVER_LOGGING), Stage_VServer_Logging)
192 CTK.publish ('^%s'%(URL_STAGE_VSERVER_LOGGING_APPLY), Stage_VServer_Logging.Apply, validation=VALIDATION, method="POST")
193
194
195 #
196 # Select Install Type
197 #
198
199 NOTE_DOWNLOAD_URL = N_("URL or path to the software package. For instance, a tar.gz or zip file.")
1d8039e @alobbs WIP: Checks if the tarball exists
alobbs authored
200 NOTE_APP_DIR = N_("Directory where the software is already installed. In case you're using your distro's package, for instance.")
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
201
202 INSTALL_OPTIONS = [
203 ('download_auto', N_('Automatic Download')),
1d8039e @alobbs WIP: Checks if the tarball exists
alobbs authored
204 ('download_URL', N_('Use a Specific Package')),
205 ('local_directory', N_('Already Installed Software')),
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
206 ]
207
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
208 class Stage_Install_Type (Phase_PrevNext):
209 def __init__ (self):
210 Phase_PrevNext.__init__ (self, _("Software Retrival Method"))
211
212 def __build_GUI__ (self):
213 # Refresh
214 refresh = CTK.Refreshable({'id': 'wizard2-stage-install-type-refresh'})
215 refresh.register (lambda: self.Refresh_Content (refresh, self).Render())
216
217 # Radio buttons
218 radios = CTK.RadioGroupCfg ('%s!install_type'%(CFG_PREFIX), INSTALL_OPTIONS, {'checked': INSTALL_OPTIONS[0][0]})
219
220 # Submitter
221 submit = CTK.Submitter (URL_STAGE_INSTALL_APPLY)
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
222 submit.bind ('submit_success', CTK.DruidContent__JS_if_internal_submit (refresh.JS_to_refresh()))
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
223 submit += radios
224
225 # GUI Layout
226 self += submit
227 self += refresh
228 self.bind ('goto_next_stage', CTK.DruidContent__JS_to_goto_next (self.id))
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
229
230 class Apply:
231 def __call__ (self):
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
232 tipe = CTK.post.get_val ('%s!install_type'%(CFG_PREFIX))
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
233
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
234 if tipe == 'download_auto':
235 CTK.cfg['%s!app_fetch'%(CFG_PREFIX)] = 'auto'
236 elif CTK.cfg.get_val('%s!app_fetch'%(CFG_PREFIX)) == 'auto':
237 del (CTK.cfg['%s!app_fetch'%(CFG_PREFIX)])
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
238
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
239 return CTK.cfg_apply_post()
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
240
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
241 class Refresh_Content (CTK.Box):
242 def __init__ (self, refresh, parent_widget):
243 CTK.Box.__init__ (self)
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
244
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
245 pself = parent_widget
246 default = INSTALL_OPTIONS[0][0]
247 method = CTK.cfg.get_val ('%s!install_type'%(CFG_PREFIX), default)
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
248
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
249 if method == 'download_auto':
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
250 None
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
251 elif method == 'download_URL':
252 self += pself.Download_URL (refresh)
253 elif method == 'local_directory':
254 self += pself.Local_Directory (refresh)
255 else:
256 self += CTK.RawHTML ('<h1>%s</h1>' %(_("Unknown method")))
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
257
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
258 class Download_URL (CTK.Box):
259 def __init__ (self, refresh):
260 CTK.Box.__init__ (self)
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
261
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
262 table = CTK.PropsTable()
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
263 table.Add (_('URL/Path to package'), CTK.TextCfg('%s!app_fetch'%(CFG_PREFIX), False, {'class':'noauto'}), _(NOTE_DOWNLOAD_URL))
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
264
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
265 submit = CTK.Submitter (URL_STAGE_INSTALL_URL_APPLY)
266 submit.bind ('submit_success', table.JS_to_trigger ('goto_next_stage'))
267 submit += table
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
268
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
269 self += CTK.RawHTML ("<h3>%s</h3>"%(_('Use a specific Package')))
270 self += submit
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
271
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
272 class Apply:
273 def __call__ (self):
274 key = '%s!app_fetch'%(CFG_PREFIX)
275 if not CTK.post.get_val(key):
276 return {'ret': 'unsatisfactory', 'errors': {key: _('Cannot be empty')}}
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
277
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
278 return CTK.cfg_apply_post()
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
279
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
280 class Local_Directory (CTK.Box):
281 def __init__ (self, refresh):
282 CTK.Box.__init__ (self)
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
283
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
284 table = CTK.PropsTable()
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
285 table.Add (_('Directory of the application'), CTK.TextCfg('%s!app_dir'%(CFG_PREFIX), False, {'class':'noauto'}), _(NOTE_APP_DIR))
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
286
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
287 submit = CTK.Submitter (URL_STAGE_INSTALL_LOCAL_APPLY)
288 submit.bind ('submit_success', table.JS_to_trigger ('goto_next_stage'))
289 submit += table
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
290
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
291 self += CTK.RawHTML ("<h3>%s</h3>"%(_('Already Installed Software')))
292 self += submit
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
293
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
294 class Apply:
295 def __call__ (self):
296 key = '%s!app_dir' %(CFG_PREFIX)
297 if not CTK.post.get_val(key):
298 return {'ret': 'unsatisfactory', 'errors': {key: _('Cannot be empty')}}
299
300 return CTK.cfg_apply_post()
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
301
302
1d8039e @alobbs WIP: Checks if the tarball exists
alobbs authored
303 def validation_download_url (value):
304 # URL or Path
305 value = validations.is_url_or_path (value)
306
307 # If path, ensure it exists
308 if value.startswith('/'):
309 value = validations.is_path (value)
310 if not os.path.exists (value):
311 raise ValueError, _('Path does not exist')
312
313 return value
314
315
316 VALIDATION_INSTALL_TYPE = VALIDATION + [
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
317 ('%s!app_fetch'%(CFG_PREFIX), validation_download_url)
1d8039e @alobbs WIP: Checks if the tarball exists
alobbs authored
318 ]
319
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
320 URL_STAGE_INSTALL_APPLY = "/wizard2/stages/install_type/apply"
321 URL_STAGE_INSTALL_URL_APPLY = "/wizard2/stages/install_type/url/apply"
322 URL_STAGE_INSTALL_LOCAL_APPLY = "/wizard2/stages/install_type/local_dir/apply"
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
323
6b8144e @alobbs Re-implements the 'Install_Type' stage completely. It also fixes a
alobbs authored
324 CTK.publish ('^%s'%(URL_STAGE_INSTALL_APPLY), Stage_Install_Type.Apply, validation=VALIDATION_INSTALL_TYPE, method="POST")
325 CTK.publish ('^%s'%(URL_STAGE_INSTALL_URL_APPLY), Stage_Install_Type.Download_URL.Apply, validation=VALIDATION_INSTALL_TYPE, method="POST")
326 CTK.publish ('^%s'%(URL_STAGE_INSTALL_LOCAL_APPLY), Stage_Install_Type.Local_Directory.Apply, validation=VALIDATION_INSTALL_TYPE, method="POST")
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
327
328
329 #
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
330 # Installation Directory
331 #
332
333 INSTALL_DIR_OPTIONS = [
334 ('auto', N_('Automatic')),
335 ('custom_dir', N_('Install in a custom directory')),
336 ]
337
338 class Stage_Install_Directory (Phase_PrevNext):
339 def __init__ (self):
340 Phase_PrevNext.__init__ (self, _("Installation Directory"))
4cd151e @alobbs Skips some phases of the installation whenever they are not required.
alobbs authored
341
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
342 def __build_GUI__ (self):
4cd151e @alobbs Skips some phases of the installation whenever they are not required.
alobbs authored
343 # Skip phase if it's configuring an already installed app
344 install_type = CTK.cfg.get_val ('%s!install_type'%(CFG_PREFIX))
345 if install_type == 'local_directory':
346 self += CTK.DruidContent_TriggerNext()
347 return
348
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
349 # Refresh
350 refresh = CTK.Refreshable({'id': 'wizard2-stage-install-dir-type-refresh'})
351 refresh.register (lambda: self.Refresh_Content (refresh, self).Render())
352
353 # Radio buttons
354 radios = CTK.RadioGroupCfg ('%s!install_dir_type'%(CFG_PREFIX), INSTALL_DIR_OPTIONS, {'checked': INSTALL_DIR_OPTIONS[0][0]})
355
356 # Submitter
357 submit = CTK.Submitter (URL_STAGE_INSTALL_DIR_APPLY)
358 submit.bind ('submit_success', CTK.DruidContent__JS_if_internal_submit (refresh.JS_to_refresh()))
359 submit += radios
360
361 # GUI Layout
362 self += submit
363 self += refresh
364
365 class Apply:
366 def __call__ (self):
367 dir_type = CTK.post.get_val ('%s!install_dir_type'%(CFG_PREFIX))
368
369 if dir_type == 'auto':
370 del (CTK.cfg['%s!app_dir'%(CFG_PREFIX)])
371 return CTK.cfg_reply_ajax_ok()
372
373 return CTK.cfg_apply_post()
374
375 class Refresh_Content (CTK.Box):
376 def __init__ (self, refresh, parent_widget):
377 CTK.Box.__init__ (self)
378
379 pself = parent_widget
380 default = INSTALL_DIR_OPTIONS[0][0]
381 method = CTK.cfg.get_val ('%s!install_dir_type'%(CFG_PREFIX), default)
382
383 if method == 'auto':
384 None
385 elif method == 'custom_dir':
386 self += pself.Custom_Dir (refresh)
387 else:
388 self += CTK.RawHTML ('<h1>%s</h1>' %(_("Unknown method")))
389
390 class Custom_Dir (CTK.Box):
391 def __init__ (self, refresh):
392 CTK.Box.__init__ (self)
393
394 table = CTK.PropsTable()
395 table.Add (_('Installation directory'), CTK.TextCfg('%s!app_dir'%(CFG_PREFIX), True, {'optional_string': _('Automatic')}), _(NOTE_APP_DIR))
396
397 submit = CTK.Submitter (URL_STAGE_INSTALL_DIR_APPLY)
398 submit += table
399
400 self += submit
401
402
403 VALIDATION_INSTALL_DIR_TYPE = [
404 ('%s!app_dir'%(CFG_PREFIX), validations.parent_is_dir),
405 ]
406
407 URL_STAGE_INSTALL_DIR_APPLY = "/wizard2/stages/install_dir_type/apply"
408
409 CTK.publish ('^%s'%(URL_STAGE_INSTALL_DIR_APPLY), Stage_Install_Directory.Apply, validation=VALIDATION_INSTALL_DIR_TYPE, method="POST")
410
411
412
413 #
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
414 # Select Install Type
415 #
416
417 def collect_arguments (installer_params):
418 # Set the installer parameters:
419 #
420 for key in CTK.cfg.keys (CFG_PREFIX):
421 installer_params[key] = CTK.cfg.get_val ('%s!%s' %(CFG_PREFIX, key))
422
423 # Special case: Empty installation directory
424 #
425 if not installer_params.get('app_dir'):
426 installer_params['app_dir'] = os.path.join (CHEROKEE_OWS_ROOT, str(int(time.time()*100)))
427
428 # Ok
429 ret = {'retcode': 0}
430 return ret
431
432 def check_params (stage_obj, installer_params, Install_Class):
433 # Instance Installer
434 #
435 installer = Install_Class (installer_params)
436 stage_obj.installer = installer
437
438 # Let the installer check the parameters
439 #
440 errors = installer.Check_Parameters()
441 if errors:
442 return {'retcode': 1, 'stderr': errors[0]}
443
444 # Ok
445 return {'retcode': 0}
446
447 def check_prerequisites (stage_obj):
448 installer = stage_obj.installer
449
450 errors = installer.Check_Prerequisites()
451 if errors:
452 return {'retcode': 1, 'stderr': errors[0]}
453
454 # Ok
455 return {'retcode': 0}
456
15a3beb @alobbs WIP: Splits the 'Download_Unpack' phase
alobbs authored
457 def download (stage_obj):
c52a392 @alobbs WIP: New download & unpack phase
alobbs authored
458 installer = stage_obj.installer
459
15a3beb @alobbs WIP: Splits the 'Download_Unpack' phase
alobbs authored
460 errors = installer.Download()
461 if errors:
462 return {'retcode': 1, 'stderr': errors[0]}
463
464 # Ok
465 return {'retcode': 0}
466
467 def unpack (stage_obj):
468 installer = stage_obj.installer
469
470 errors = installer.Unpack()
c52a392 @alobbs WIP: New download & unpack phase
alobbs authored
471 if errors:
472 return {'retcode': 1, 'stderr': errors[0]}
473
474 # Ok
475 return {'retcode': 0}
476
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
477 def configure_cherokee (stage_obj):
478 installer = stage_obj.installer
479
480 errors = installer.Configure_Cherokee()
481 if errors:
482 return {'retcode': 1, 'stderr': errors[0]}
483
484 # Ok
485 return {'retcode': 0}
486
487
488 class Stage_Do_Install (Phase_Cancel):
489 def __init__ (self, Install_Class, next_url):
490 Phase_Cancel.__init__ (self, _("Installing.."))
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
491 self.Install_Class = Install_Class
492 self.next_url = next_url
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
493
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
494 def __build_GUI__ (self):
4cd151e @alobbs Skips some phases of the installation whenever they are not required.
alobbs authored
495 install_type = CTK.cfg.get_val ('%s!install_type'%(CFG_PREFIX))
496
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
497 # Logic Installer
498 self.installer_params = {}
499
4cd151e @alobbs Skips some phases of the installation whenever they are not required.
alobbs authored
500 # Commands (first block)
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
501 commands = [
502 ({'function': collect_arguments, 'description': "Collecting arguments...", 'params': {'installer_params': self.installer_params}}),
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
503 ({'function': check_params, 'description': "Checking parameters...", 'params': {'installer_params': self.installer_params, 'stage_obj': self, 'Install_Class': self.Install_Class}}),
c52a392 @alobbs WIP: New download & unpack phase
alobbs authored
504 ({'function': check_prerequisites, 'description': "Checking requisites...", 'params': {'stage_obj': self}}),
4cd151e @alobbs Skips some phases of the installation whenever they are not required.
alobbs authored
505 ]
506
507 # Commands (Download and Unpack are optional)
508 if install_type != 'local_directory':
509 commands += [
510 ({'function': download, 'description': "Downloading...", 'params': {'stage_obj': self}}),
511 ({'function': unpack, 'description': "Unpacking...", 'params': {'stage_obj': self}}),
512 ]
513
514 # Commands (second block)
515 commands += [
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
516 ({'function': configure_cherokee, 'description': "Configuring...", 'params': {'stage_obj': self}}),
517 ]
518
519 # GUI
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
520 progress = CommandProgress.CommandProgress (commands, self.next_url)
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
521 self += progress
522
523 #
524 # Select Install Type
525 #
526
45081c4 @alobbs WIP: Final stage
alobbs authored
527 class Stage_Finished (Phase_Close):
528 class Apply:
529 def __call__ (self):
530 return CTK.cfg_reply_ajax_ok()
531
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
532 def __init__ (self):
45081c4 @alobbs WIP: Final stage
alobbs authored
533 Phase_Close.__init__ (self, _("Installation Finished"))
2714d26 @alobbs WIP: Split of the stages. Fixes a number of keyboard handling errors.
alobbs authored
534
535 def __build_GUI__ (self):
f976980 @alobbs Wizards 2.0 - initial import
alobbs authored
536 self += CTK.RawHTML ('We are done and dusted!')
45081c4 @alobbs WIP: Final stage
alobbs authored
537
538
539 URL_STAGE_FINISHED_APPLY = "/wizard2/stages/finished/apply"
540 CTK.publish ('^%s'%(URL_STAGE_FINISHED_APPLY), Stage_Finished.Apply, method="POST")
Something went wrong with that request. Please try again.