Merge "iptables_manager: Fix get_binary_name for eventlet"
This commit is contained in:
commit
d82cc2d826
@ -18,9 +18,9 @@
|
|||||||
|
|
||||||
"""Implements iptables rules using linux utilities."""
|
"""Implements iptables rules using linux utilities."""
|
||||||
|
|
||||||
import inspect
|
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
|
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
from oslo.utils import excutils
|
from oslo.utils import excutils
|
||||||
@ -42,7 +42,7 @@ LOG = logging.getLogger(__name__)
|
|||||||
# (max_chain_name_length - len('-POSTROUTING') == 16)
|
# (max_chain_name_length - len('-POSTROUTING') == 16)
|
||||||
def get_binary_name():
|
def get_binary_name():
|
||||||
"""Grab the name of the binary we're running in."""
|
"""Grab the name of the binary we're running in."""
|
||||||
return os.path.basename(inspect.stack()[-1][1])[:16]
|
return os.path.basename(sys.argv[0])[:16]
|
||||||
|
|
||||||
binary_name = get_binary_name()
|
binary_name = get_binary_name()
|
||||||
|
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import inspect
|
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
import mock
|
import mock
|
||||||
from oslo.config import cfg
|
from oslo.config import cfg
|
||||||
@ -190,8 +190,8 @@ class IptablesManagerStateFulTestCase(base.BaseTestCase):
|
|||||||
self.execute = mock.patch.object(self.iptables, "execute").start()
|
self.execute = mock.patch.object(self.iptables, "execute").start()
|
||||||
|
|
||||||
def test_binary_name(self):
|
def test_binary_name(self):
|
||||||
self.assertEqual(iptables_manager.binary_name,
|
expected = os.path.basename(sys.argv[0])[:16]
|
||||||
os.path.basename(inspect.stack()[-1][1])[:16])
|
self.assertEqual(expected, iptables_manager.binary_name)
|
||||||
|
|
||||||
def test_get_chain_name(self):
|
def test_get_chain_name(self):
|
||||||
name = '0123456789' * 5
|
name = '0123456789' * 5
|
||||||
|
Loading…
x
Reference in New Issue
Block a user