1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | from paste.script.templates import Template, var, _skip_variables |
---|
4 | import os |
---|
5 | import socket |
---|
6 | _hostTuple = socket.gethostbyaddr(socket.gethostname()) |
---|
7 | try: |
---|
8 | # Get first alias from list if present |
---|
9 | _hostname = _hostTuple[1][0] |
---|
10 | except TypeError: |
---|
11 | # ... or default to hostname |
---|
12 | _hostname = _hostTuple[0] |
---|
13 | |
---|
14 | vars = [ |
---|
15 | var('siteName', |
---|
16 | ('Full name for this site used by the Attribute Authority to describe ' |
---|
17 | 'this site'), |
---|
18 | default='NDG Partner Site'), |
---|
19 | var('attributeAuthorityID', |
---|
20 | ('Unique identity by which this Attribute Authority will be known by ' |
---|
21 | 'other trusted sites'), |
---|
22 | default=_hostname) |
---|
23 | ] |
---|
24 | |
---|
25 | class DefaultDeploymentTemplate(Template): |
---|
26 | _template_dir = 'default_deployment' |
---|
27 | summary = 'NERC DataGrid Security services deployment template' |
---|
28 | vars = vars |
---|
29 | |
---|
30 | # Single Sign On Service not included in this template |
---|
31 | # def write_files(self, command, output_dir, vars): |
---|
32 | # '''Extend to enable substitutions for Single Sign On Service config |
---|
33 | # file''' |
---|
34 | # if output_dir.startswith('./'): |
---|
35 | # outDir = output_dir.lstrip('./') |
---|
36 | # else: |
---|
37 | # outDir = output_dir |
---|
38 | # |
---|
39 | # vars['ssoConfigDir'] = os.path.join(os.getcwd(), outDir, 'sso') |
---|
40 | # super(DefaultDeploymentTemplate, self).write_files(command, |
---|
41 | # output_dir, |
---|
42 | # vars) |
---|
43 | |
---|
44 | class FullDeploymentTemplate(Template): |
---|
45 | _template_dir = 'full_deployment' |
---|
46 | summary = ('NERC DataGrid Security services full deployment template ' |
---|
47 | 'including the Single Sign On Service') |
---|
48 | vars = vars |
---|
49 | |
---|
50 | def write_files(self, command, output_dir, vars): |
---|
51 | '''Extend to enable substitutions for Single Sign On Service config |
---|
52 | file''' |
---|
53 | if output_dir.startswith('./'): |
---|
54 | outDir = output_dir.lstrip('./') |
---|
55 | else: |
---|
56 | outDir = output_dir |
---|
57 | |
---|
58 | vars['installDir'] = os.path.join(os.getcwd(), outDir) |
---|
59 | super(FullDeploymentTemplate, self).write_files(command, |
---|
60 | output_dir, |
---|
61 | vars) |
---|