~kyrofa/unity-scope-snappy/launcher_scope

« back to all changes in this revision

Viewing changes to store/actions/failed_runner.go

  • Committer: Tarmac
  • Author(s): Kyle Fazzari
  • Date: 2015-07-08 14:22:02 UTC
  • mfrom: (8.11.10 unity-scope-snappy)
  • Revision ID: tarmac-20150708142202-my94j1pj3q9qyysw
Hook up DBus client to action runners.

Approved by PS Jenkins bot, Xavi Garcia.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package actions
 
2
 
 
3
import (
 
4
        "launchpad.net/unity-scope-snappy/internal/launchpad.net/go-unityscopes/v2"
 
5
        "launchpad.net/unity-scope-snappy/store/operation"
 
6
        "launchpad.net/unity-scope-snappy/store/packages"
 
7
)
 
8
 
 
9
// FailedRunner is an action Runner to handle a failed install or uninstall
 
10
// operation.
 
11
type FailedRunner struct{}
 
12
 
 
13
// NewFailedRunner creates a new FailedRunner.
 
14
//
 
15
// Returns:
 
16
// - Pointer to new FailedRunner.
 
17
// - Error (nil if none).
 
18
func NewFailedRunner() (*FailedRunner, error) {
 
19
        return new(FailedRunner), nil
 
20
}
 
21
 
 
22
// Run shoves the failed state into the metadata to be passed to the preview.
 
23
//
 
24
// Parameters:
 
25
// stateManager: Package state manager (not used).
 
26
// snapId: ID of the snap upon which the operation just had an error (not used).
 
27
//
 
28
// Return:
 
29
// - Pointer to an ActivationResponse for showing the preview.
 
30
// - Error (nil if none).
 
31
func (runner FailedRunner) Run(packageManager packages.DbusManager, snapId string) (*scopes.ActivationResponse, error) {
 
32
        response := scopes.NewActivationResponse(scopes.ActivationShowPreview)
 
33
 
 
34
        response.SetScopeData(operation.Metadata{Failed: true})
 
35
 
 
36
        return response, nil
 
37
}