mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Make PyLint even happier.
This commit is contained in:
parent
ea0a07b985
commit
2b6ae8428b
1 changed files with 22 additions and 9 deletions
|
@ -1,4 +1,5 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
'''\
|
||||
Welcome to the Salt repl which exposes the execution environment of a minion in
|
||||
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.
|
||||
|
||||
'''
|
||||
import atexit
|
||||
|
||||
# Import python libs
|
||||
import atexit
|
||||
import os
|
||||
import pprint
|
||||
import readline
|
||||
import rlcompleter
|
||||
import sys
|
||||
from code import InteractiveConsole
|
||||
|
||||
import jinja2
|
||||
import yaml
|
||||
|
||||
# Import salt libs
|
||||
import salt.client
|
||||
import salt.config
|
||||
import salt.loader
|
||||
|
@ -38,10 +36,22 @@ import salt.output
|
|||
import salt.pillar
|
||||
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():
|
||||
'''
|
||||
Save the history file
|
||||
'''
|
||||
readline.write_history_file(HISTFILE)
|
||||
|
||||
|
||||
|
@ -71,7 +81,7 @@ def get_salt_vars():
|
|||
__opts__.get('environment'),
|
||||
).compile_pillar()
|
||||
|
||||
JINJA = lambda x, **y: jinja2.Template(x).render(
|
||||
JINJA = lambda x, **y: jinja2.Template(x).render( # pylint: disable=C0103,W0612
|
||||
grains=__grains__,
|
||||
salt=__salt__,
|
||||
opts=__opts__,
|
||||
|
@ -82,6 +92,9 @@ def get_salt_vars():
|
|||
|
||||
|
||||
def main():
|
||||
'''
|
||||
The main entry point
|
||||
'''
|
||||
salt_vars = get_salt_vars()
|
||||
|
||||
def salt_outputter(value):
|
||||
|
@ -106,7 +119,7 @@ def main():
|
|||
readline.read_history_file(HISTFILE)
|
||||
|
||||
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.interact(banner=__doc__)
|
||||
|
|
Loading…
Add table
Reference in a new issue