Pull binary name from sys.argv[0]

Instead of inspecting the top of the stack to find the binary name, just
use sys.argv[0].  This is little cleaner then inspecting the stack.

Co-authored-by: Mark McClain <mark.mcclain@dreamhost.com>

Change-Id: I18d5233b6b0bd0ccaeeab5b7ce5006adcf4a8d40
This commit is contained in:
Joe Gordon 2013-05-27 17:08:53 +03:00
parent e06ab58774
commit 0a9229c14f
1 changed files with 1 additions and 2 deletions

View File

@ -19,7 +19,6 @@
"""Generic Node base class for all workers that run on hosts.""" """Generic Node base class for all workers that run on hosts."""
import inspect
import os import os
import random import random
import sys import sys
@ -238,7 +237,7 @@ class Service(service.Service):
if not host: if not host:
host = CONF.host host = CONF.host
if not binary: if not binary:
binary = os.path.basename(inspect.stack()[-1][1]) binary = os.path.basename(sys.argv[0])
if not topic: if not topic:
topic = binary.rpartition('nova-')[2] topic = binary.rpartition('nova-')[2]
if not manager: if not manager: