Move deprecation warning after logging starts up

It was getting called in the other spot, it just wasn't actually
doing anything. Here it prints the message on the cli
This commit is contained in:
Wayne Werner 2019-01-29 11:38:09 -06:00
parent f4a584e33b
commit 0ed4326e94
No known key found for this signature in database
GPG key ID: C36D3A8D5BEF0935
3 changed files with 21 additions and 24 deletions

View file

@ -20,6 +20,7 @@ from random import randint
# Import salt libs
from salt.exceptions import SaltSystemExit, SaltClientError, SaltReqTimeoutError
import salt.defaults.exitcodes # pylint: disable=unused-import
import salt.ext.six as six
log = logging.getLogger(__name__)
@ -93,6 +94,16 @@ def salt_master():
Start the salt master.
'''
import salt.cli.daemons
# REMOVEME after Python 2.7 support is dropped (also the six import)
if six.PY2:
from salt.utils.versions import warn_until
# Message borrowed from pip's deprecation warning
warn_until('Sodium',
'Python 2.7 will reach the end of its life on January 1st,'
' 2020. Please upgrade your Python as Python 2.7 won\'t be'
' maintained after that date. Salt will drop support for'
' Python 2.7 in the Sodium release or later.')
# END REMOVEME
master = salt.cli.daemons.Master()
master.start()
@ -179,6 +190,16 @@ def salt_minion():
minion = salt.cli.daemons.Minion()
minion.start()
return
# REMOVEME after Python 2.7 support is dropped (also the six import)
elif six.PY2:
from salt.utils.versions import warn_until
# Message borrowed from pip's deprecation warning
warn_until('Sodium',
'Python 2.7 will reach the end of its life on January 1st,'
' 2020. Please upgrade your Python as Python 2.7 won\'t be'
' maintained after that date. Salt will drop support for'
' Python 2.7 in the Sodium release or later.')
# END REMOVEME
if '--disable-keepalive' in sys.argv:
sys.argv.remove('--disable-keepalive')

View file

@ -3,13 +3,10 @@
Start the salt-master
'''
import salt.ext.six as six
import salt.utils.platform
from salt.scripts import salt_master
if __name__ == '__main__':
if salt.utils.platform.is_windows():
# Since this file does not have a '.py' extension, when running on
@ -22,14 +19,4 @@ if __name__ == '__main__':
cfile = os.path.splitext(__file__)[0] + '.pyc'
if not os.path.exists(cfile):
py_compile.compile(__file__, cfile)
# REMOVEME after Python 2.7 support is dropped (also the six import)
elif six.PY2:
from salt.utils.versions import warn_until
# Message borrowed from pip's deprecation warning
warn_until('Sodium',
'Python 2.7 will reach the end of its life on January 1st,'
' 2020. Please upgrade your Python as Python 2.7 won\'t be'
' maintained after that date. Salt will drop support for'
' Python 2.7 in the Sodium release or later.')
# END REMOVEME
salt_master()

View file

@ -3,7 +3,6 @@
This script is used to kick off a salt minion daemon
'''
import salt.ext.six as six
import salt.utils.platform
from salt.scripts import salt_minion
from multiprocessing import freeze_support
@ -21,16 +20,6 @@ if __name__ == '__main__':
cfile = os.path.splitext(__file__)[0] + '.pyc'
if not os.path.exists(cfile):
py_compile.compile(__file__, cfile)
# REMOVEME after Python 2.7 support is dropped (also the six import)
elif six.PY2:
from salt.utils.versions import warn_until
# Message borrowed from pip's deprecation warning
warn_until('Sodium',
'Python 2.7 will reach the end of its life on January 1st,'
' 2020. Please upgrade your Python as Python 2.7 won\'t be'
' maintained after that date. Salt will drop support for'
' Python 2.7 in the Sodium release or later.')
# END REMOVEME
# This handles the bootstrapping code that is included with frozen
# scripts. It is a no-op on unfrozen code.
freeze_support()