[dnm] set trap signal

Signed-off-by: Ruslan Aliev <raliev@mirantis.com>
Change-Id: I327851d0c918398662c7b7cc7807aa7a58b7e703
This commit is contained in:
Ruslan Aliev 2023-06-05 18:17:08 -05:00
parent 275dc4506f
commit 101894243f
2 changed files with 22 additions and 0 deletions

View File

@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import signal
import sys
import pdb
import falcon
from oslo_config import cfg
from oslo_policy import policy
@ -35,6 +39,11 @@ from armada.exceptions import base_exception as exceptions
conf.set_app_default_configs()
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
def signal_handler(sig, frame):
pdb.set_trace()
def create(enable_middleware=CONF.middleware):
@ -87,6 +96,9 @@ def create(enable_middleware=CONF.middleware):
# Built-in error serializer
api.set_error_serializer(exceptions.default_error_serializer)
signal.signal(signal.SIGUSR1, signal_handler)
LOG.info("SIGNAL TRAP SERVER SET")
return api

View File

@ -12,6 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import signal
import sys
import pdb
from urllib.parse import urlparse
import click
@ -27,6 +31,10 @@ from armada.common.session import ArmadaSession
CONF = cfg.CONF
def signal_handler(sig, frame):
pdb.set_trace()
@click.group()
@click.option('--debug', help="Enable debug logging", is_flag=True)
@click.option(
@ -77,6 +85,8 @@ def main(ctx, debug, api, url, token):
log.set_defaults(default_log_levels=CONF.default_log_levels)
log.setup(CONF, 'armada')
signal.signal(signal.SIGUSR1, signal_handler)
log.INFO("SIGNAL TRAP SET")
main.add_command(apply_create)