plainbox:abc: add ISessionStateTransport interface

This interface describes all plainbox 'transports' which allow the user
to send the stream of exported session data after a sequence of tests.

This interface differs from the old de-facto interface it replaced by
moving additional, session-specific parameters to send(). It also
standardizes on passing both the configuration object and the session
state objects, along with the data stream to send, so that specialized
transports may access additional information.

Lastly the interface now specifies exceptions that may be raised as well
as the return value that is expected. This should allow anyone to use
arbitrary transport in an uniform way.

Fixes: https://bugs.launchpad.net/plainbox/+bug/1301967

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:transport: make TransportBase inherit ISessionStateTransport

This patch makes TransportBase (abstract base class for transports)
implement the ISessionStateTransport interface. This allows us to drop
the send() method (it is in the interface now) and focus just on the
implementation of __init__()

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:transport: add TransportError

This patch adds a new exception that transport classes may raise to
translate from transport specific library exceptions to PlainBox
exceptions.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:commands:run: fix typo

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:commands:run: pass config and session to transport.send()

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:commands:run: use TransportError

This patch drops all understanding of requests error classes in favor
of the standard TransportError exception that all transports can now raise

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox:highlevel: use TransportError

This patch drops all understanding of requests error classes in favor
of the standard TransportError exception that all transports can now raise

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
plainbox: drop dependency on requests

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
checkbox-ng:config: define SECURE_ID_PATTERN

This patch moves the pattern of correct secure IDs into a new variable
so that it can be used by other modules that need to perform the same
validation.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
checkbox-ng:commands:sru: update transport code

This patch updates the code that used transports to match changes to
the ISessionStateTransport interface. The initializer no longer raises
InvalidSecureIDError, instead all errors are now effectively raised by
.send() which also takes two new arguments, the configuration object
and the session state object.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
checkbox-ng:commands:sru: use TransportError

This patch drops all understanding of requests error classes in favor
of the standard TransportError exception that all transports can now raise

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
checkbox-ng:certification: refactor CertificationTransport API

This patch updates the API of CertificationTransport class so that it
properly implements the new ISessionStateTransport interface. The
configuration parameter moved from the initializer to the send() method.
Some minor changes to code layout and docstrings were made, to match
other parts of the code.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
checkbox-ng:certification: wrap request errors in TransportError

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>