Added pydoc for functions in Cli()

This commit is contained in:
Michael DeHaan 2012-03-02 21:11:43 -05:00
parent e9a24cdad4
commit bf967adf83

View file

@ -17,6 +17,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
########################################################
try: try:
import json import json
except ImportError: except ImportError:
@ -32,7 +34,10 @@ import ansible.constants as C
from optparse import OptionParser from optparse import OptionParser
from ansible.utils import * from ansible.utils import *
########################################################
class Cli(object): class Cli(object):
''' code behind bin/ansible '''
# ---------------------------------------------- # ----------------------------------------------
@ -42,6 +47,7 @@ class Cli(object):
# ---------------------------------------------- # ----------------------------------------------
def parse(self): def parse(self):
''' create an options parser for bin/ansible '''
parser = OptionParser(usage = 'ansible <host-pattern> [options]') parser = OptionParser(usage = 'ansible <host-pattern> [options]')
parser.add_option("-a", "--args", dest="module_args", parser.add_option("-a", "--args", dest="module_args",
@ -74,6 +80,7 @@ class Cli(object):
# ---------------------------------------------- # ----------------------------------------------
def run(self, options, args): def run(self, options, args):
''' use Runner lib to do SSH things '''
pattern = args[0] pattern = args[0]
sshpass = None sshpass = None
@ -96,6 +103,7 @@ class Cli(object):
# ---------------------------------------------- # ----------------------------------------------
def output(self, results, options, args): def output(self, results, options, args):
''' summarize results from Runner '''
if results is None: if results is None:
exit("No hosts matched") exit("No hosts matched")
@ -119,6 +127,8 @@ class Cli(object):
print buf print buf
########################################################
if __name__ == '__main__': if __name__ == '__main__':
cli = Cli() cli = Cli()
(options, args) = cli.parse() (options, args) = cli.parse()