mccli.init_utils

canonical_url(url)

Strip URL of protocol info and ending slashes

oidc_gen_command(iss)

Return a string containing the appropriate oidc-gen command for given issuer, including suggested scopes.

check_and_replace_long_token(token, str_init_token)

If token too long, create a new OTP to be used as ssh password, by hashing given token.

init_token(*args, **kwargs)
valid_mc_url(mc_endpoint, verify=True)

Checks if there is a motley_cue service running at provided url and returns the url Raises an exception otherwise.

init_endpoint(ssh_args, verify=True)

Initialise motley_cue endpoint from ssh args.

(HACKY) Try to get the ssh host from ssh_args by executing the ssh command with invalid -b option and parsing the output for the actual HOSTNAME.

Then try to use default value for motley_cue endpoint: https://HOSTNAME If this is not reachable, issue warning and try: http://HOSTNAME:8080 If also not reachable, exit and ask user to specify it using –mc-endpoint

init_user(mc_endpoint, token, verify=True)

Get remote username, will be deployed if it doesn’t exist.

augmented_scp_command(scp_command, token, oa_account, iss, verify=False)

Receives an ScpCommand object and adds the username for each host that is remote and has no user specified, by contacting the motley_cue service on that host. Returns new scp command as list, as well as the tokens that should be passed as passwords, in order. A third list contains the string representation of each command used to get each token.

init_cache()

Function to install caching for HTTP requests.

Make sure to call this function after setting log level for full output.

warn_if_outdated()

Warn user if the installed version of mccli is outdated. Runs in a separate thread to not slow down the execution of the command.