Skip to content

Commit 110a62f

Browse files
author
Dean Troyer
committed
Add importing file to import warnings
Add the Python file doing the import to the warnings emitted by the modules moved to osc-lib. Users will at least have a hint as to which package is out-of-date. Change-Id: I633b440c30b2b15cfde7a9013e30dfa39ab200bc
1 parent 84c83fc commit 110a62f

7 files changed

Lines changed: 28 additions & 7 deletions

File tree

openstackclient/api/auth.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
1515
# or Jun 2017.
1616

17+
import inspect
1718
import sys
1819

1920
from osc_lib.api.auth import * # noqa
2021

2122

23+
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
2224
sys.stderr.write(
2325
"WARNING: %s is deprecated and will be removed after Jun 2017. "
24-
"Please use osc_lib.api.auth\n" % __name__
26+
"Please use osc_lib.api.auth. This warning is caused by an "
27+
"out-of-date import in %s\n" % (__name__, parent_import)
2528
)

openstackclient/common/command.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@
1515
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
1616
# or Jun 2017.
1717

18+
import inspect
1819
import sys
1920

2021
from osc_lib.command.command import * # noqa
2122

2223

24+
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
2325
sys.stderr.write(
2426
"WARNING: %s is deprecated and will be removed after Jun 2017. "
25-
"Please use osc_lib.command.command\n" % __name__
27+
"Please use osc_lib.command.command. This warning is caused by an "
28+
"out-of-date import in %s\n" % (__name__, parent_import)
2629
)

openstackclient/common/exceptions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
1515
# or Jun 2017.
1616

17+
import inspect
1718
import sys
1819

1920
from osc_lib.exceptions import * # noqa
2021

2122

23+
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
2224
sys.stderr.write(
2325
"WARNING: %s is deprecated and will be removed after Jun 2017. "
24-
"Please use osc_lib.exceptions\n" % __name__
26+
"Please use osc_lib.exceptions. This warning is caused by an "
27+
"out-of-date import in %s\n" % (__name__, parent_import)
2528
)

openstackclient/common/logs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,16 @@
1414
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
1515
# or Jun 2017.
1616

17+
import inspect
1718
import sys
1819

1920
from osc_lib.logs import * # noqa
2021
from osc_lib.logs import _FileFormatter # noqa
2122

2223

24+
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
2325
sys.stderr.write(
2426
"WARNING: %s is deprecated and will be removed after Jun 2017. "
25-
"Please use osc_lib.logs\n" % __name__
27+
"Please use osc_lib.logs. This warning is caused by an "
28+
"out-of-date import in %s\n" % (__name__, parent_import)
2629
)

openstackclient/common/parseractions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
1515
# or Jun 2017.
1616

17+
import inspect
1718
import sys
1819

1920
from osc_lib.cli.parseractions import * # noqa
2021

2122

23+
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
2224
sys.stderr.write(
2325
"WARNING: %s is deprecated and will be removed after Jun 2017. "
24-
"Please use osc_lib.cli.parseractions\n" % __name__
26+
"Please use osc_lib.cli.parseractions. This warning is caused by an "
27+
"out-of-date import in %s\n" % (__name__, parent_import)
2528
)

openstackclient/common/timing.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
1515
# or Jun 2017.
1616

17+
import inspect
1718
import sys
1819

1920
from osc_lib.command.timing import * # noqa
2021

2122

23+
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
2224
sys.stderr.write(
2325
"WARNING: %s is deprecated and will be removed after Jun 2017. "
24-
"Please use osc_lib.command.timing\n" % __name__
26+
"Please use osc_lib.command.timing. This warning is caused by an "
27+
"out-of-date import in %s\n" % (__name__, parent_import)
2528
)

openstackclient/common/utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,15 @@
1414
# NOTE(dtroyer): This file is deprecated in Jun 2016, remove after 4.x release
1515
# or Jun 2017.
1616

17+
import inspect
1718
import sys
1819

1920
from osc_lib.utils import * # noqa
2021

2122

23+
parent_import = inspect.getouterframes(inspect.currentframe())[1][1]
2224
sys.stderr.write(
2325
"WARNING: %s is deprecated and will be removed after Jun 2017. "
24-
"Please use osc_lib.utils\n" % __name__
26+
"Please use osc_lib.utils. This warning is caused by an "
27+
"out-of-date import in %s\n" % (__name__, parent_import)
2528
)

0 commit comments

Comments
 (0)