Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1039)

Side by Side Diff: worker/apiuniter/tools.go

Issue 13512049: worker/apiuniter: Clone uniter, fix imports (Closed)
Patch Set: Created 11 years, 7 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « worker/apiuniter/state_test.go ('k') | worker/apiuniter/tools_test.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details.
3
4 package apiuniter
5
6 import (
7 "fmt"
8 "os"
9 "path/filepath"
10
11 "launchpad.net/juju-core/worker/apiuniter/jujuc"
12 )
13
14 // EnsureJujucSymlinks creates a symbolic link to jujuc within dir for each
15 // hook command. If the commands already exist, this operation does nothing.
16 func EnsureJujucSymlinks(dir string) (err error) {
17 for _, name := range jujuc.CommandNames() {
18 // The link operation fails when the target already exists,
19 // so this is a no-op when the command names already
20 // exist.
21 err := os.Symlink("./jujud", filepath.Join(dir, name))
22 if err == nil {
23 continue
24 }
25 // TODO(rog) drop LinkError check when fix is released (see http ://codereview.appspot.com/6442080/)
26 if e, ok := err.(*os.LinkError); !ok || !os.IsExist(e.Err) {
27 return fmt.Errorf("cannot initialize hook commands in %q : %v", dir, err)
28 }
29 }
30 return nil
31 }
OLDNEW
« no previous file with comments | « worker/apiuniter/state_test.go ('k') | worker/apiuniter/tools_test.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b