source: TI12-security/trunk/python/ndg.security.server/ndg/security/server/paster_templates/template.py @ 4692

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI12-security/trunk/python/ndg.security.server/ndg/security/server/paster_templates/template.py@4692
Revision 4692, 1.2 KB checked in by pjkersha, 11 years ago (diff)

Refactoring of SSO service to enable use of local AA and SM instances via keys to environ.

  • Property svn:executable set to *
Line 
1#!/usr/bin/env python
2
3from paste.script.templates import Template, var, _skip_variables
4import os
5import socket
6_hostTuple = socket.gethostbyaddr(socket.gethostname())
7try:
8    # Get first alias from list if present
9    _hostname = _hostTuple[1][0]
10except TypeError:
11    # ... or default to hostname
12    _hostname = _hostTuple[0]
13   
14vars = [
15    var('attributeAuthorityID', 
16        ('Unique identity by which this Attribute Authority will be known by '
17         'other trusted sites'),
18        default=_hostname)
19]
20
21class DefaultDeploymentTemplate(Template):
22    _template_dir = 'default_deployment'
23    summary = 'NERC DataGrid Security services deployment template'
24    vars = vars
25
26    def write_files(self, command, output_dir, vars):
27        '''Extend to enable substitutions for Single Sign On Service config
28        file'''
29        if output_dir.startswith('./'):
30            outDir = output_dir.lstrip('./')
31        else:
32            outDir = output_dir
33           
34        vars['ssoConfigDir'] = os.path.join(os.getcwd(), outDir, 'sso')
35        super(DefaultDeploymentTemplate, self).write_files(command, 
36                                                           output_dir, 
37                                                           vars)
Note: See TracBrowser for help on using the repository browser.