module

Krikri::PluginHelpers::MysqlConnection

MysqlConnection - building a mysql:// connection URI from Ansible-style login_* params, with the same implicit ~/.my.cnf option-file fallback real Ansible's own mysql_* modules rely on. mysql_db/mysql_user/mysql_info/mysql_query do the actual DB.open.

Constants

DEFAULT_OPTION_FILE = "~/.my.cnf"

The default option file every one of community.mysql's mysql_* modules threads through as config_file: (its argument_spec default is literally ~/.my.cnf; the module reads it whenever it exists, via the client lib's read_default_file). Explicit login_* params always win over it - it only fills in what a task didn't pass explicitly.

Class methods

build_uri(host : String | Nil = nil, port : String | Nil = nil, user : String | Nil = nil, password : String | Nil = nil, unix_socket : String | Nil = nil, config_file : String | Nil = nil, db : String | Nil = nil) : String
Source
option_file_defaults(config_file : String | Nil) : NamedTuple(user: String | Nil, password: String | Nil, socket: String | Nil)
Source
resolve_option_file_path(config_file : String) : String | Nil

Resolves a config_file path to an absolute path, expanding a leading ~ the same way Python's os.path.expanduser does (real Ansible's path-type params pass through that before any existence check). Crystal's own File.expand_path does NOT expand ~ (it treats it as a literal relative component), which is why this hand-rolls the tilde expansion exactly like BasePlugin#expand_tilde does.

Source
strip_quotes(value : String) : String
Source