eca40cb90fc2e955c5258b0eb821049880d1c9a4
[mirror/dsa-puppet.git] / 3rdparty / modules / horizon / templates / local_settings.py.erb
1 import os
2
3 from django.utils.translation import ugettext_lazy as _
4
5 from openstack_dashboard import exceptions
6
7 DEBUG = <%= @django_debug.to_s.capitalize %>
8 TEMPLATE_DEBUG = DEBUG
9
10 # Required for Django 1.5.
11 # If horizon is running in production (DEBUG is False), set this
12 # with the list of host/domain names that the application can serve.
13 # For more information see:
14 # https://docs.djangoproject.com/en/dev/ref/settings/#allowed-hosts
15 #ALLOWED_HOSTS = ['horizon.example.com', ]
16 <% if @final_allowed_hosts.kind_of?(Array) %>
17 ALLOWED_HOSTS = ['<%= @final_allowed_hosts.join("', '") %>', ]
18 <% else %>
19 ALLOWED_HOSTS = ['<%= @final_allowed_hosts %>', ]
20 <% end %>
21
22 # Set SSL proxy settings:
23 # For Django 1.4+ pass this header from the proxy after terminating the SSL,
24 # and don't forget to strip it from the client's request.
25 # For more information see:
26 # https://docs.djangoproject.com/en/1.4/ref/settings/#secure-proxy-ssl-header
27 # SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')
28
29 # If Horizon is being served through SSL, then uncomment the following two
30 # settings to better secure the cookies from security exploits
31 <% if @secure_cookies %>
32 CSRF_COOKIE_SECURE = True
33 SESSION_COOKIE_SECURE = True
34 <% else %>
35 #CSRF_COOKIE_SECURE = True
36 #SESSION_COOKIE_SECURE = True
37 <% end %>
38
39 # Overrides for OpenStack API versions. Use this setting to force the
40 # OpenStack dashboard to use a specfic API version for a given service API.
41 # NOTE: The version should be formatted as it appears in the URL for the
42 # service API. For example, The identity service APIs have inconsistent
43 # use of the decimal point, so valid options would be "2.0" or "3".
44 # OPENSTACK_API_VERSIONS = {
45 #     "identity": 3
46 # }
47
48 # Set this to True if running on multi-domain model. When this is enabled, it
49 # will require user to enter the Domain name in addition to username for login.
50 # OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = False
51
52 # Overrides the default domain used when running on single-domain model
53 # with Keystone V3. All entities will be created in the default domain.
54 # OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default'
55
56 # Set Console type:
57 # valid options would be "AUTO", "VNC" or "SPICE"
58 # CONSOLE_TYPE = "AUTO"
59
60 # Default OpenStack Dashboard configuration.
61 HORIZON_CONFIG = {
62     'dashboards': ('project', 'admin', 'settings',),
63     'default_dashboard': 'project',
64     'user_home': 'openstack_dashboard.views.get_user_home',
65     'ajax_queue_limit': 10,
66     'auto_fade_alerts': {
67         'delay': 3000,
68         'fade_duration': 1500,
69         'types': ['alert-success', 'alert-info']
70     },
71     'help_url': "<%= @help_url %>",
72     'exceptions': {'recoverable': exceptions.RECOVERABLE,
73                    'not_found': exceptions.NOT_FOUND,
74                    'unauthorized': exceptions.UNAUTHORIZED},
75 }
76
77 # Specify a regular expression to validate user passwords.
78 # HORIZON_CONFIG["password_validator"] = {
79 #     "regex": '.*',
80 #     "help_text": _("Your password does not meet the requirements.")
81 # }
82
83 # Disable simplified floating IP address management for deployments with
84 # multiple floating IP pools or complex network requirements.
85 # HORIZON_CONFIG["simple_ip_management"] = False
86
87 # Turn off browser autocompletion for the login form if so desired.
88 # HORIZON_CONFIG["password_autocomplete"] = "off"
89
90 LOCAL_PATH = os.path.dirname(os.path.abspath(__file__))
91
92 # Set custom secret key:
93 # You can either set it to a specific value or you can let horizion generate a
94 # default secret key that is unique on this machine, e.i. regardless of the
95 # amount of Python WSGI workers (if used behind Apache+mod_wsgi): However, there
96 # may be situations where you would want to set this explicitly, e.g. when
97 # multiple dashboard instances are distributed on different machines (usually
98 # behind a load-balancer). Either you have to make sure that a session gets all
99 # requests routed to the same dashboard instance or you set the same SECRET_KEY
100 # for all of them.
101 # from horizon.utils import secret_key
102 # SECRET_KEY = secret_key.generate_or_read_from_file(os.path.join(LOCAL_PATH, '.secret_key_store'))
103 SECRET_KEY = '<%= @secret_key %>'
104
105 # We recommend you use memcached for development; otherwise after every reload
106 # of the django development server, you will have to login again. To use
107 # memcached set CACHES to something like
108 # CACHES = {
109 #    'default': {
110 #        'BACKEND' : 'django.core.cache.backends.memcached.MemcachedCache',
111 #        'LOCATION' : '127.0.0.1:11211',
112 #    }
113 #}
114
115 CACHES = {
116     'default': {
117         <% if @cache_server_ip %>
118 #        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
119         'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
120           <% if @cache_server_ip.kind_of?(Array) %>
121             <%  split = ":" + @cache_server_port + "','" %>
122         'LOCATION': [ <% @cache_server_ip.each do |ip| -%>'<%= ip -%>:<%= @cache_server_port -%>',<% end -%> ],
123             <% else %>
124         'LOCATION': '<%= @cache_server_ip %>:<%= @cache_server_port %>',
125           <% end %>
126         <% else %>
127         'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'
128         <% end %>
129     }
130 }
131
132 <% if @django_session_engine %>
133 SESSION_ENGINE = "<%= @django_session_engine %>"
134 <% end %>
135
136 # Send email to the console by default
137 EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
138 # Or send them to /dev/null
139 #EMAIL_BACKEND = 'django.core.mail.backends.dummy.EmailBackend'
140
141 # Configure these for your outgoing email host
142 # EMAIL_HOST = 'smtp.my-company.com'
143 # EMAIL_PORT = 25
144 # EMAIL_HOST_USER = 'djangomail'
145 # EMAIL_HOST_PASSWORD = 'top-secret!'
146
147 # For multiple regions uncomment this configuration, and add (endpoint, title).
148 <% if @available_regions.kind_of?(Array) %>
149 AVAILABLE_REGIONS = [
150 <% @available_regions.each do |r| -%>
151     ('<%= r[0] -%>', '<%= r[1] -%>'),
152 <% end -%>
153 ]
154 <% end -%>
155
156 <%
157 if (!@keystone_scheme.nil?) || (!@keystone_host.nil?) || (!@keystone_port.nil?)
158     @keystone_scheme ||= "http"
159     @keystone_host ||= "127.0.0.1"
160     @keystone_port ||= "5000"
161     @keystone_url = "#{@keystone_scheme}://#{@keystone_host}:#{@keystone_port}/v2.0"
162 end
163 -%>
164 OPENSTACK_KEYSTONE_URL = "<%= @keystone_url %>"
165 OPENSTACK_KEYSTONE_DEFAULT_ROLE = "<%= @keystone_default_role %>"
166
167 # Disable SSL certificate checks (useful for self-signed certificates):
168 # OPENSTACK_SSL_NO_VERIFY = True
169
170 # The CA certificate to use to verify SSL connections
171 # OPENSTACK_SSL_CACERT = '/path/to/cacert.pem'
172
173 # The OPENSTACK_KEYSTONE_BACKEND settings can be used to identify the
174 # capabilities of the auth backend for Keystone.
175 # If Keystone has been configured to use LDAP as the auth backend then set
176 # can_edit_user to False and name to 'ldap'.
177 #
178 # TODO(tres): Remove these once Keystone has an API to identify auth backend.
179 OPENSTACK_KEYSTONE_BACKEND = {
180     'name': 'native',
181     'can_edit_user': True,
182     'can_edit_group': True,
183     'can_edit_project': True,
184     'can_edit_domain': True,
185     'can_edit_role': True
186 }
187
188 # The OPENSTACK_HYPERVISOR_FEATURES settings can be used to enable optional
189 # services provided by hypervisors.
190 OPENSTACK_HYPERVISOR_FEATURES = {
191     <%- @hypervisor_options = @hypervisor_defaults.merge(@hypervisor_options) -%>
192     'can_set_mount_point': <%= @hypervisor_options['can_set_mount_point'].to_s.capitalize %>,
193     'can_set_password': <%= @hypervisor_options['can_set_password'].to_s.capitalize %>,
194 }
195
196 # The OPENSTACK_CINDER_FEATURES settings can be used to enable optional
197 # # services provided by cinder that is not exposed by its extension API.
198 OPENSTACK_CINDER_FEATURES = {
199     <%- @cinder_options = @cinder_defaults.merge(@cinder_options) -%>
200     'enable_backup': <%= @cinder_options['enable_backup'].to_s.capitalize %>,
201 }
202
203 # The OPENSTACK_NEUTRON_NETWORK settings can be used to enable optional
204 # services provided by neutron. Options currenly available are load
205 # balancer service, security groups, quotas, VPN service.
206 OPENSTACK_NEUTRON_NETWORK = {
207     <%- @neutron_options = @neutron_defaults.merge(@neutron_options) -%>
208     'enable_lb': <%= @neutron_options['enable_lb'].to_s.capitalize %>,
209     'enable_firewall': <%= @neutron_options['enable_firewall'].to_s.capitalize %>,
210     'enable_quotas': <%= @neutron_options['enable_quotas'].to_s.capitalize %>,
211     'enable_security_group': <%= @neutron_options['enable_security_group'].to_s.capitalize %>,
212     'enable_vpn': <%= @neutron_options['enable_vpn'].to_s.capitalize %>,
213     # The profile_support option is used to detect if an externa lrouter can be
214     # configured via the dashboard. When using specific plugins the
215     # profile_support can be turned on if needed.
216     <%- if @neutron_options['profile_support'] != 'None' -%>
217     'profile_support': '<%= @neutron_options['profile_support'] %>',
218     <%- end -%>
219     #'profile_support': 'cisco',
220 }
221
222 # The OPENSTACK_IMAGE_BACKEND settings can be used to customize features
223 # in the OpenStack Dashboard related to the Image service, such as the list
224 # of supported image formats.
225 # OPENSTACK_IMAGE_BACKEND = {
226 #     'image_formats': [
227 #         ('', ''),
228 #         ('aki', _('AKI - Amazon Kernel Image')),
229 #         ('ami', _('AMI - Amazon Machine Image')),
230 #         ('ari', _('ARI - Amazon Ramdisk Image')),
231 #         ('iso', _('ISO - Optical Disk Image')),
232 #         ('qcow2', _('QCOW2 - QEMU Emulator')),
233 #         ('raw', _('Raw')),
234 #         ('vdi', _('VDI')),
235 #         ('vhd', _('VHD')),
236 #         ('vmdk', _('VMDK'))
237 #     ]
238 # }
239
240 # OPENSTACK_ENDPOINT_TYPE specifies the endpoint type to use for the endpoints
241 # in the Keystone service catalog. Use this setting when Horizon is running
242 # external to the OpenStack environment. The default is 'publicURL'.
243 #OPENSTACK_ENDPOINT_TYPE = "publicURL"
244 <% if @openstack_endpoint_type %>
245 OPENSTACK_ENDPOINT_TYPE = "<%= @openstack_endpoint_type %>"
246 <% end %>
247
248 # SECONDARY_ENDPOINT_TYPE specifies the fallback endpoint type to use in the
249 # case that OPENSTACK_ENDPOINT_TYPE is not present in the endpoints
250 # in the Keystone service catalog. Use this setting when Horizon is running
251 # external to the OpenStack environment. The default is None.  This
252 # value should differ from OPENSTACK_ENDPOINT_TYPE if used.
253 #SECONDARY_ENDPOINT_TYPE = "publicURL"
254 <% if @secondary_endpoint_type %>
255 SECONDARY_ENDPOINT_TYPE = "<%= @secondary_endpoint_type %>"
256 <% end %>
257
258 # The number of objects (Swift containers/objects or images) to display
259 # on a single page before providing a paging element (a "more" link)
260 # to paginate results.
261 API_RESULT_LIMIT = <%= @api_result_limit %>
262 API_RESULT_PAGE_SIZE = 20
263
264 # The timezone of the server. This should correspond with the timezone
265 # of your entire OpenStack installation, and hopefully be in UTC.
266 TIME_ZONE = "UTC"
267
268 # If you have external monitoring links, eg:
269 <% if @horizon_app_links %>
270 EXTERNAL_MONITORING = <%= @horizon_app_links %>
271 <% end %>
272
273 # When launching an instance, the menu of available flavors is
274 # sorted by RAM usage, ascending.  Provide a callback method here
275 # (and/or a flag for reverse sort) for the sorted() method if you'd
276 # like a different behaviour.  For more info, see
277 # http://docs.python.org/2/library/functions.html#sorted
278 # CREATE_INSTANCE_FLAVOR_SORT = {
279 #     'key': my_awesome_callback_method,
280 #     'reverse': False,
281 # }
282
283 # The Horizon Policy Enforcement engine uses these values to load per service
284 # policy rule files. The content of these files should match the files the
285 # OpenStack services are using to determine role based access control in the
286 # target installation.
287
288 # Path to directory containing policy.json files
289 <% if !(@policy_files_path.nil?) %>
290 POLICY_FILES_PATH = '<%= @policy_files_path %>'
291 <% elsif @osfamily == 'RedHat' %>
292 POLICY_FILES_PATH = '/etc/openstack-dashboard'
293 <% else %>
294 #POLICY_FILES_PATH = os.path.join(ROOT_PATH, "conf")
295 <% end -%>
296
297 # Map of local copy of service policy files
298 <% if @policy_files.kind_of?(Hash) %>
299 POLICY_FILES = {
300 <% @policy_files.sort.each do |service_name,filename| -%>
301     '<%= service_name -%>': '<%= filename -%>',
302 <% end -%>
303 } # POLICY_FILES
304 <% else -%>
305 #POLICY_FILES = {
306 #    'identity': 'keystone_policy.json',
307 #    'compute': 'nova_policy.json'
308 #}
309 <% end -%>
310
311 # Trove user and database extension support. By default support for
312 # creating users and databases on database instances is turned on.
313 # To disable these extensions set the permission here to something
314 # unusable such as ["!"].
315 # TROVE_ADD_USER_PERMS = []
316 # TROVE_ADD_DATABASE_PERMS = []
317
318 LOGGING = {
319     'version': 1,
320     # When set to True this will disable all logging except
321     # for loggers specified in this configuration dictionary. Note that
322     # if nothing is specified here and disable_existing_loggers is True,
323     # django.db.backends will still log unless it is disabled explicitly.
324     'disable_existing_loggers': False,
325     'formatters': {
326         'verbose': {
327             'format': '%(asctime)s %(process)d %(levelname)s %(name)s '
328                       '%(message)s'
329         },
330     },
331     'handlers': {
332         'null': {
333             'level': 'DEBUG',
334             'class': 'django.utils.log.NullHandler',
335         },
336         'console': {
337             # Set the level to "DEBUG" for verbose output logging.
338             'level': 'INFO',
339             'class': 'logging.StreamHandler',
340         },
341         'file': {
342             'level': '<%= @log_level %>',
343             'class': 'logging.FileHandler',
344             'filename': '<%= scope.lookupvar("horizon::params::logdir") %>/horizon.log',
345             'formatter': 'verbose',
346         },
347     },
348     'loggers': {
349         # Logging from django.db.backends is VERY verbose, send to null
350         # by default.
351         'django.db.backends': {
352             'handlers': ['null'],
353             'propagate': False,
354         },
355         'requests': {
356             'handlers': ['null'],
357             'propagate': False,
358         },
359         'horizon': {
360             # 'handlers': ['console'],
361             'handlers': ['file'],
362             # 'level': 'DEBUG',
363             'level': '<%= @log_level %>',
364             'propagate': False,
365         },
366         'openstack_dashboard': {
367             # 'handlers': ['console'],
368             'handlers': ['file'],
369             # 'level': 'DEBUG',
370             'level': '<%= @log_level %>',
371             'propagate': False,
372         },
373         'novaclient': {
374             # 'handlers': ['console'],
375             'handlers': ['file'],
376             # 'level': 'DEBUG',
377             'level': '<%= @log_level %>',
378             'propagate': False,
379         },
380         'cinderclient': {
381             # 'handlers': ['console'],
382             'handlers': ['file'],
383             # 'level': 'DEBUG',
384             'level': '<%= @log_level %>',
385             'propagate': False,
386         },
387         'keystoneclient': {
388             # 'handlers': ['console'],
389             'handlers': ['file'],
390             # 'level': 'DEBUG',
391             'level': '<%= @log_level %>',
392             'propagate': False,
393         },
394         'glanceclient': {
395             # 'handlers': ['console'],
396             'handlers': ['file'],
397             # 'level': 'DEBUG',
398             'level': '<%= @log_level %>',
399             'propagate': False,
400         },
401         'neutronclient': {
402             # 'handlers': ['console'],
403             'handlers': ['file'],
404             # 'level': 'DEBUG',
405             'level': '<%= @log_level %>',
406             'propagate': False,
407         },
408         'heatclient': {
409             # 'handlers': ['console'],
410             'handlers': ['file'],
411             # 'level': 'DEBUG',
412             'level': '<%= @log_level %>',
413             'propagate': False,
414         },
415         'ceilometerclient': {
416             # 'handlers': ['console'],
417             'handlers': ['file'],
418             # 'level': 'DEBUG',
419             'level': '<%= @log_level %>',
420             'propagate': False,
421         },
422         'troveclient': {
423             # 'handlers': ['console'],
424             'handlers': ['file'],
425             # 'level': 'DEBUG',
426             'level': '<%= @log_level %>',
427             'propagate': False,
428         },
429         'swiftclient': {
430             # 'handlers': ['console'],
431             'handlers': ['file'],
432             # 'level': 'DEBUG',
433             'level': '<%= @log_level %>',
434             'propagate': False,
435         },
436         'openstack_auth': {
437             # 'handlers': ['console'],
438             'handlers': ['file'],
439             # 'level': 'DEBUG',
440             'level': '<%= @log_level %>',
441             'propagate': False,
442         },
443         'nose.plugins.manager': {
444             # 'handlers': ['console'],
445             'handlers': ['file'],
446             # 'level': 'DEBUG',
447             'level': '<%= @log_level %>',
448             'propagate': False,
449         },
450         'django': {
451             # 'handlers': ['console'],
452             'handlers': ['file'],
453             # 'level': 'DEBUG',
454             'level': '<%= @log_level %>',
455             'propagate': False,
456         },
457     }
458 }
459
460 SECURITY_GROUP_RULES = {
461     'all_tcp': {
462         'name': 'ALL TCP',
463         'ip_protocol': 'tcp',
464         'from_port': '1',
465         'to_port': '65535',
466     },
467     'all_udp': {
468         'name': 'ALL UDP',
469         'ip_protocol': 'udp',
470         'from_port': '1',
471         'to_port': '65535',
472     },
473     'all_icmp': {
474         'name': 'ALL ICMP',
475         'ip_protocol': 'icmp',
476         'from_port': '-1',
477         'to_port': '-1',
478     },
479     'ssh': {
480         'name': 'SSH',
481         'ip_protocol': 'tcp',
482         'from_port': '22',
483         'to_port': '22',
484     },
485     'smtp': {
486         'name': 'SMTP',
487         'ip_protocol': 'tcp',
488         'from_port': '25',
489         'to_port': '25',
490     },
491     'dns': {
492         'name': 'DNS',
493         'ip_protocol': 'tcp',
494         'from_port': '53',
495         'to_port': '53',
496     },
497     'http': {
498         'name': 'HTTP',
499         'ip_protocol': 'tcp',
500         'from_port': '80',
501         'to_port': '80',
502     },
503     'pop3': {
504         'name': 'POP3',
505         'ip_protocol': 'tcp',
506         'from_port': '110',
507         'to_port': '110',
508     },
509     'imap': {
510         'name': 'IMAP',
511         'ip_protocol': 'tcp',
512         'from_port': '143',
513         'to_port': '143',
514     },
515     'ldap': {
516         'name': 'LDAP',
517         'ip_protocol': 'tcp',
518         'from_port': '389',
519         'to_port': '389',
520     },
521     'https': {
522         'name': 'HTTPS',
523         'ip_protocol': 'tcp',
524         'from_port': '443',
525         'to_port': '443',
526     },
527     'smtps': {
528         'name': 'SMTPS',
529         'ip_protocol': 'tcp',
530         'from_port': '465',
531         'to_port': '465',
532     },
533     'imaps': {
534         'name': 'IMAPS',
535         'ip_protocol': 'tcp',
536         'from_port': '993',
537         'to_port': '993',
538     },
539     'pop3s': {
540         'name': 'POP3S',
541         'ip_protocol': 'tcp',
542         'from_port': '995',
543         'to_port': '995',
544     },
545     'ms_sql': {
546         'name': 'MS SQL',
547         'ip_protocol': 'tcp',
548         'from_port': '1433',
549         'to_port': '1433',
550     },
551     'mysql': {
552         'name': 'MYSQL',
553         'ip_protocol': 'tcp',
554         'from_port': '3306',
555         'to_port': '3306',
556     },
557     'rdp': {
558         'name': 'RDP',
559         'ip_protocol': 'tcp',
560         'from_port': '3389',
561         'to_port': '3389',
562     },
563 }
564
565 LOGIN_URL = '<%= scope.lookupvar("horizon::params::root_url") %>/auth/login/'
566 LOGOUT_URL = '<%= scope.lookupvar("horizon::params::root_url") %>/auth/logout/'
567 LOGIN_REDIRECT_URL = '<%= scope.lookupvar("horizon::params::root_url") %>'
568
569 # The Ubuntu package includes pre-compressed JS and compiled CSS to allow
570 # offline compression by default.  To enable online compression, install
571 # the python-lesscpy package and disable the following option.
572 COMPRESS_OFFLINE = <%= @compress_offline.to_s.capitalize %>
573
574 # For Glance image upload, Horizon uses the file upload support from Django
575 # so we add this option to change the directory where uploaded files are temporarily
576 # stored until they are loaded into Glance.
577 FILE_UPLOAD_TEMP_DIR = '<%= @file_upload_temp_dir %>'