mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
Make PyLint even happier.
This commit is contained in:
parent
ea0a07b985
commit
2b6ae8428b
@ -1,4 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
'''\
|
'''\
|
||||||
Welcome to the Salt repl which exposes the execution environment of a minion in
|
Welcome to the Salt repl which exposes the execution environment of a minion in
|
||||||
a pre-configured Python shell
|
a pre-configured Python shell
|
||||||
@ -19,18 +20,15 @@ A history file is maintained in ~/.saltsh_history.
|
|||||||
completion behavior can be customized via the ~/.inputrc file.
|
completion behavior can be customized via the ~/.inputrc file.
|
||||||
|
|
||||||
'''
|
'''
|
||||||
import atexit
|
|
||||||
|
# Import python libs
|
||||||
import atexit
|
import atexit
|
||||||
import os
|
import os
|
||||||
import pprint
|
|
||||||
import readline
|
import readline
|
||||||
import rlcompleter
|
|
||||||
import sys
|
import sys
|
||||||
from code import InteractiveConsole
|
from code import InteractiveConsole
|
||||||
|
|
||||||
import jinja2
|
# Import salt libs
|
||||||
import yaml
|
|
||||||
|
|
||||||
import salt.client
|
import salt.client
|
||||||
import salt.config
|
import salt.config
|
||||||
import salt.loader
|
import salt.loader
|
||||||
@ -38,10 +36,22 @@ import salt.output
|
|||||||
import salt.pillar
|
import salt.pillar
|
||||||
import salt.runner
|
import salt.runner
|
||||||
|
|
||||||
HISTFILE = "{HOME}/.saltsh_history".format(**os.environ)
|
# Import 3rd party libs
|
||||||
|
import jinja2
|
||||||
|
|
||||||
|
# pylint: disable=W0611
|
||||||
|
# These are imported to be available in the spawmed shell
|
||||||
|
import yaml
|
||||||
|
import pprint
|
||||||
|
# pylint: enable=W0611
|
||||||
|
|
||||||
|
HISTFILE = '{HOME}/.saltsh_history'.format(**os.environ)
|
||||||
|
|
||||||
|
|
||||||
def savehist():
|
def savehist():
|
||||||
|
'''
|
||||||
|
Save the history file
|
||||||
|
'''
|
||||||
readline.write_history_file(HISTFILE)
|
readline.write_history_file(HISTFILE)
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +81,7 @@ def get_salt_vars():
|
|||||||
__opts__.get('environment'),
|
__opts__.get('environment'),
|
||||||
).compile_pillar()
|
).compile_pillar()
|
||||||
|
|
||||||
JINJA = lambda x, **y: jinja2.Template(x).render(
|
JINJA = lambda x, **y: jinja2.Template(x).render( # pylint: disable=C0103,W0612
|
||||||
grains=__grains__,
|
grains=__grains__,
|
||||||
salt=__salt__,
|
salt=__salt__,
|
||||||
opts=__opts__,
|
opts=__opts__,
|
||||||
@ -82,6 +92,9 @@ def get_salt_vars():
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
'''
|
||||||
|
The main entry point
|
||||||
|
'''
|
||||||
salt_vars = get_salt_vars()
|
salt_vars = get_salt_vars()
|
||||||
|
|
||||||
def salt_outputter(value):
|
def salt_outputter(value):
|
||||||
@ -106,7 +119,7 @@ def main():
|
|||||||
readline.read_history_file(HISTFILE)
|
readline.read_history_file(HISTFILE)
|
||||||
|
|
||||||
atexit.register(savehist)
|
atexit.register(savehist)
|
||||||
atexit.register(lambda: sys.stdout.write("Salt you later!\n"))
|
atexit.register(lambda: sys.stdout.write('Salt you later!\n'))
|
||||||
|
|
||||||
saltrepl = InteractiveConsole(locals=salt_vars)
|
saltrepl = InteractiveConsole(locals=salt_vars)
|
||||||
saltrepl.interact(banner=__doc__)
|
saltrepl.interact(banner=__doc__)
|
||||||
|
Loading…
Reference in New Issue
Block a user