Browse Source

Merge "Remove security info from log output if not development mode"

Jenkins 3 years ago
parent
commit
ec1b92a973
1 changed files with 14 additions and 1 deletions
  1. 14
    1
      fuel_health/config.py

+ 14
- 1
fuel_health/config.py View File

@@ -20,6 +20,7 @@ from __future__ import print_function
20 20
 import os
21 21
 import sys
22 22
 import unittest2
23
+import yaml
23 24
 
24 25
 import keystoneclient
25 26
 try:
@@ -425,6 +426,8 @@ FuelConf = [
425 426
                 default=False,
426 427
                 help='ssl usage'),
427 428
     cfg.BoolOpt('ssl_data',
429
+                default=False),
430
+    cfg.BoolOpt('development_mode',
428 431
                 default=False)
429 432
 ]
430 433
 
@@ -591,6 +594,13 @@ class NailgunConfig(object):
591 594
         if parse:
592 595
             self.prepare_config()
593 596
 
597
+    @property
598
+    def development_mode(self):
599
+        with open('/etc/nailgun/settings.yaml') as nailgun_opts:
600
+            nailgun_settings = yaml.safe_load(nailgun_opts)
601
+        self.fuel.development_mode = nailgun_settings['DEVELOPMENT']
602
+        return nailgun_settings['DEVELOPMENT']
603
+
594 604
     def prepare_config(self, *args, **kwargs):
595 605
         try:
596 606
             self._parse_meta()
@@ -619,7 +629,10 @@ class NailgunConfig(object):
619 629
         response = self.req_session.get(self.nailgun_url + api_url)
620 630
         LOG.info('RESPONSE %s STATUS %s' % (api_url, response.status_code))
621 631
         data = response.json()
622
-        LOG.info('RESPONSE FROM %s - %s' % (api_url, data))
632
+
633
+        if self.development_mode:
634
+            LOG.info('RESPONSE FROM %s - %s' % (api_url, data))
635
+
623 636
         access_data = data['editable']['access']
624 637
         common_data = data['editable']['common']
625 638
 

Loading…
Cancel
Save