Set debug level of nova container_config_scripts only when enabled

Right now all scripts log in DEBUG level. This change enables only
DEBUG level if debug is also enabled for the nova service.

Change-Id: Ie58a6630877a58bec8ce763ede166997bd41f882
This commit is contained in:
Martin Schuppert 2019-04-30 13:19:05 +02:00
parent 9e55d59cef
commit 4d4263f4f1
5 changed files with 62 additions and 4 deletions

View File

@ -22,7 +22,14 @@ import time
random.seed() random.seed()
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) debug = os.getenv('__OS_DEBUG', 'false')
if debug.lower() == 'true':
loglevel = logging.DEBUG
else:
loglevel = logging.INFO
logging.basicConfig(stream=sys.stdout, level=loglevel)
LOG = logging.getLogger('nova_cell_v2_discover_hosts') LOG = logging.getLogger('nova_cell_v2_discover_hosts')
iterations = 10 iterations = 10

View File

@ -20,7 +20,14 @@ import pwd
import stat import stat
import sys import sys
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) debug = os.getenv('__OS_DEBUG', 'false')
if debug.lower() == 'true':
loglevel = logging.DEBUG
else:
loglevel = logging.INFO
logging.basicConfig(stream=sys.stdout, level=loglevel)
LOG = logging.getLogger('nova_statedir') LOG = logging.getLogger('nova_statedir')

View File

@ -28,7 +28,14 @@ from novaclient import client
from six.moves.configparser import SafeConfigParser from six.moves.configparser import SafeConfigParser
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) debug = os.getenv('__OS_DEBUG', 'false')
if debug.lower() == 'true':
loglevel = logging.DEBUG
else:
loglevel = logging.INFO
logging.basicConfig(stream=sys.stdout, level=loglevel)
LOG = logging.getLogger('nova_wait_for_compute_service') LOG = logging.getLogger('nova_wait_for_compute_service')
iterations = 60 iterations = 60

View File

@ -32,7 +32,14 @@ import requests
from six.moves.configparser import SafeConfigParser from six.moves.configparser import SafeConfigParser
logging.basicConfig(stream=sys.stdout, level=logging.DEBUG) debug = os.getenv('__OS_DEBUG', 'false')
if debug.lower() == 'true':
loglevel = logging.DEBUG
else:
loglevel = logging.INFO
logging.basicConfig(stream=sys.stdout, level=loglevel)
LOG = logging.getLogger('nova_wait_for_placement_service') LOG = logging.getLogger('nova_wait_for_placement_service')
iterations = 60 iterations = 60

View File

@ -545,6 +545,13 @@ outputs:
- '' - ''
- - 'TRIPLEO_DEPLOY_IDENTIFIER=' - - 'TRIPLEO_DEPLOY_IDENTIFIER='
- {get_param: DeployIdentifier} - {get_param: DeployIdentifier}
- list_join:
- ''
- - '__OS_DEBUG='
- yaql:
expression: str($.data.debug)
data:
debug: {get_attr: [NovaBase, role_data, config_settings, 'nova::logging::debug']}
step_4: step_4:
map_merge: map_merge:
- nova_wait_for_placement_service: - nova_wait_for_placement_service:
@ -558,6 +565,14 @@ outputs:
- /var/lib/container-config-scripts/:/container-config-scripts/:z - /var/lib/container-config-scripts/:/container-config-scripts/:z
- /var/lib/config-data/puppet-generated/nova_libvirt/etc/nova:/etc/nova:ro - /var/lib/config-data/puppet-generated/nova_libvirt/etc/nova:/etc/nova:ro
command: "/container-config-scripts/pyshim.sh /container-config-scripts/nova_wait_for_placement_service.py" command: "/container-config-scripts/pyshim.sh /container-config-scripts/nova_wait_for_placement_service.py"
environment:
- list_join:
- ''
- - '__OS_DEBUG='
- yaql:
expression: str($.data.debug)
data:
debug: {get_attr: [NovaBase, role_data, config_settings, 'nova::logging::debug']}
- nova_compute: - nova_compute:
start_order: 3 start_order: 3
image: *nova_compute_image image: *nova_compute_image
@ -616,6 +631,14 @@ outputs:
- /var/lib/container-config-scripts/:/container-config-scripts/ - /var/lib/container-config-scripts/:/container-config-scripts/
user: nova user: nova
command: "/container-config-scripts/pyshim.sh /container-config-scripts/nova_wait_for_compute_service.py" command: "/container-config-scripts/pyshim.sh /container-config-scripts/nova_wait_for_compute_service.py"
environment:
- list_join:
- ''
- - '__OS_DEBUG='
- yaql:
expression: str($.data.debug)
data:
debug: {get_attr: [NovaBase, role_data, config_settings, 'nova::logging::debug']}
- {} - {}
step_5: step_5:
if: if:
@ -642,6 +665,13 @@ outputs:
- '' - ''
- - 'TRIPLEO_DEPLOY_IDENTIFIER=' - - 'TRIPLEO_DEPLOY_IDENTIFIER='
- {get_param: DeployIdentifier} - {get_param: DeployIdentifier}
- list_join:
- ''
- - '__OS_DEBUG='
- yaql:
expression: str($.data.debug)
data:
debug: {get_attr: [NovaBase, role_data, config_settings, 'nova::logging::debug']}
- {} - {}
host_prep_tasks: host_prep_tasks:
list_concat: list_concat: