InteractiveTomcatManager

class tomcatmanager.InteractiveTomcatManager

Bases: cmd2.cmd2.Cmd

An interactive command line tool for the Tomcat Manager web application.

each command sets the value of the instance variable exit_code, which mirrors bash standard values for exit codes (available via $?)

status_to_stdout

Proxy property for feedback_to_output.

poutput(msg: Any, end='\n')

Convenient shortcut for self.stdout.write(); by default adds newline to end if not already present.

Also handles BrokenPipeError exceptions for when a commands’s output has been piped to another process and that process terminates before the cmd2 command is finished executing.

Parameters:
  • msg – str - message to print to current stdout - anyting convertible to a str with ‘{}’.format() is OK
  • end – str - string appended after the end of the message if not already present, default a newline
perror(errmsg: str, exception_type=None, traceback_war=True)

Print an error message or an exception.

Param:errmsg The error message to print. If None, then print information about the exception currently beging handled.
Param:exception_type From superclass. Ignored here.
Param:traceback_war From superclass. Ignored here.

If debug=True, you will get a full stack trace, otherwise just the exception.

pfeedback(msg: str)

Print nonessential feedback.

Set quiet=True to supress all feedback. If feedback_to_output=True, then feedback will be included in the output stream. Otherwise, it will be sent to sys.stderr.

emptyline()

Do nothing on an empty line

default(statement: cmd2.parsing.Statement)

what to do if we don’t recognize the command the user entered

docmd(func: Callable, *args, **kwargs) → Any

Call a function and return, printing any exceptions that occur

Sets exit_code to 0 and calls {func}. If func throws a TomcatError, set exit_code to 1 and print the exception

show_help_from(argparser: argparse.ArgumentParser)

Set exit code and output help from an argparser.

parse_args(parser: argparse.ArgumentParser, argv: List[T]) → argparse.Namespace

Use argparse to parse a list of arguments a-la sys.argv

do_help(arglist: List[T])

Show available commands, or help on a specific command.

do_config(cmdline: cmd2.parsing.Statement)

Edit or show the location of the user configuration file.

help_config()

Show help for the ‘config’ command.

do_show(cmdline: cmd2.parsing.Statement)

Show all settings or a specific setting.

help_show()

Show help for the ‘show’ command.

do_settings(cmdline: cmd2.parsing.Statement)

Synonym for ‘show’ command.

help_settings()

Show help for the ‘settings’ command.

do_set(args: cmd2.parsing.Statement)

Change program settings.

help_set()

Show help for the ‘set’ command.

config_file

The location of the user configuration file.

Returns:The full path to the user configuration file, or None if self.appdirs has not been defined.
history_file

The location of the command history file.

Returns:The full path to the file where command history will be saved and loaded, or None if self.appdirs has not been defined.
load_config()

Open and parse the user config file and set self.config.

convert_to_boolean(value: Any)

Return a boolean value translating from other types if necessary.

do_connect(cmdline: cmd2.parsing.Statement)

Connect to a tomcat manager instance.

help_connect()

Show help for the connect command.

do_which(*args, **kwargs)

Show the url of the tomcat server you are connected to.

help_which()

Show help for the ‘which’ command.

deploy_local(args: argparse.Namespace, update: bool = False)

Deploy a local war file to the tomcat server.

deploy_server(args: argparse.Namespace, update: bool = False)

Deploy a war file to the tomcat server.

deploy_context(args: argparse.Namespace, update: bool = False)

Deploy a context xml file to the tomcat server.

do_deploy(*args, **kwargs)

Deploy an application to the tomcat server.

help_deploy()

Show help for the deploy command.

do_redeploy(*args, **kwargs)

Redeploy an application to the tomcat server.

help_redeploy()

Show help for the redeploy command.

do_undeploy(*args, **kwargs)

Remove an application from the tomcat server.

help_undeploy()

Help for the ‘undeploy’ command.

do_start(*args, **kwargs)

Start a deployed tomcat application that isn’t running.

help_start()

Help for the ‘start’ command.

do_stop(*args, **kwargs)

Stop a tomcat application and leave it deployed on the server.

help_stop()

Help for the ‘stop’ command.

do_reload(*args, **kwargs)

Start and stop a tomcat application.

help_reload()

Help for the ‘reload’ command.

do_restart(*args, **kwargs)

Start and stop a tomcat application.

help_restart()

Show help for the ‘restart’ command.

do_sessions(*args, **kwargs)

Show active sessions for a tomcat application.

help_sessions()

Help for the ‘sessions’ command.

do_expire(*args, **kwargs)

Expire idle sessions.

help_expire()

Help for the ‘expire’ command.

do_list(*args, **kwargs)

Show all installed applications.

help_list()

Show help for the ‘list’ command.

do_serverinfo(*args, **kwargs)

Show information about the tomcat server.

help_serverinfo()

Show help for the ‘serverinfo’ command.

do_status(*args, **kwargs)

Show server status information in xml format.

help_status()

Show help for the ‘status’ command.

do_vminfo(*args, **kwargs)

Show diagnostic information about the jvm.

help_vminfo()

Show help for the ‘vminfo’ command.

do_sslconnectorciphers(*args, **kwargs)

Show SSL/TLS ciphers configured for each connector.

help_sslconnectorciphers()

Show help for the ‘sslconnectorciphers’ command.

do_threaddump(*args, **kwargs)

Show a jvm thread dump.

help_threaddump()

Show help for the ‘threaddump’ command.

do_resources(*args, **kwargs)

Show global JNDI resources configured in Tomcat.

help_resources()

Show help for the ‘resources’ command.

do_findleakers(*args, **kwargs)

Show tomcat applications that leak memory.

help_findleakers()

Show help for the ‘findleakers’ command.

do_exit(_)

Exit the interactive command prompt.

do_quit(cmdline: cmd2.parsing.Statement)

Synonym for the ‘exit’ command.

do_eof(cmdline: cmd2.parsing.Statement)

Exit on the end-of-file character.

do_version(cmdline: cmd2.parsing.Statement)

Show the version number of this program.

help_version()

Show help for the ‘version’ command.

do_exit_code(_)

Show a number indicating the status of the previous command.

help_exit_code()

Show help for the ‘exit_code’ command.

do_license(cmdline: cmd2.parsing.Statement)

Show the software license for this program.

help_license()

Show help for the ‘license’ command.