kojismokydingo.cli.clients

Koji Smoky Dingo - CLI Client Commands

author:

Christopher O'Brien <obriencj@gmail.com>

license:

GPL v3

exception CannotOpenURL[source]

Bases: BadDingo

A problem occured opening a URL

Since:

2.0

complaint: str = 'Cannot open URL'
class ClientConfig(name=None)[source]

Bases: AnonSmokyDingo

Parameters:

name (str) -- The name that this command is being represented as

activate()[source]

Activate our session. This is triggered after validate, before pre_handle and handle

The session and goptions attributes will have been set just prior.

arguments(parser)[source]

Override to add relevant arguments to the given parser instance. May return an alternative parser instance or None.

Parameters:

parser -- the parser to decorate with additional arguments

description: str = 'Show client profile settings'

Short description of this command, for use in the help output

group: str = 'info'

The koji CLI group that this command will be displayed under in the help output

handle(options)[source]

Perform the full set of actions for this command.

class ClientOpen(name=None)[source]

Bases: AnonSmokyDingo

Parameters:

name (str) -- The name that this command is being represented as

arguments(parser)[source]

Override to add relevant arguments to the given parser instance. May return an alternative parser instance or None.

Parameters:

parser -- the parser to decorate with additional arguments

description: str = 'Launch web UI for koji data elements'

Short description of this command, for use in the help output

group: str = 'info'

The koji CLI group that this command will be displayed under in the help output

handle(options)[source]

Perform the full set of actions for this command.

validate(parser, options)[source]

Override to perform validation on options values. Return value is ignored, use parser.error if needed.

cli_client_config(session, goptions, only=(), quiet=False, config=False, json=False)[source]

Implements the koji client-config command

Since:

1.0

Parameters:
cli_open(session, goptions, datatype, element, command=None)[source]

Implements the koji open command

Since:

1.0

Parameters:
  • session (ClientSession)

  • goptions (GOptions)

  • datatype (str)

  • element (str)

  • command (str | None)

Return type:

int

get_open_command(profile=None, err=True)[source]

Determine the command used to open URLs. Attempts to load profile-specific plugin configuration under the heading 'open' and the key 'command' first. If that doesn't find a command, then fall back to the per-platform mappings in the OPEN_CMD dict.

Parameters:
  • profile (str | None) -- name of koji profile

  • err (bool) -- raise an exception if no command is discovered. If False then will return None instead

Raises:

BadDingo -- when err is True and no command could be found

Since:

1.0

Return type:

str

get_open_url(session, goptions, datatype, element)[source]

Given a client configuration, datatype, and element identifier, produce a URL referencing the hub or topdir path for that record.

Parameters:
  • session (ClientSession) -- an active koji client session

  • goptions (GOptions | None) -- koji client options. If None, an appropriate object will be reconstructed from the session opts.

  • datatype (str) -- name of the data type

  • element (str | int | Dict) -- identifier for an element of the given data type, or the loaded element itself

Since:

2.0

Return type:

str