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

Issue 6488084: add charm.Deployer; extend charm.GitDir

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 8 months ago by fwereade
Modified:
11 years, 8 months ago
Reviewers:
mp+122807
Visibility:
Public.

Description

add charm.Deployer; extend charm.GitDir Deployer makes heavy use of GitDirs to implement the charm install/upgrade procedures. https://code.launchpad.net/~fwereade/juju-core/uniter-charm-deployer/+merge/122807 (do not edit description out of merge proposal)

Patch Set 1 #

Patch Set 2 : add charm.Deployer; extend charm.GitDir #

Total comments: 14

Patch Set 3 : add charm.Deployer; extend charm.GitDir #

Total comments: 19

Patch Set 4 : add charm.Deployer; extend charm.GitDir #

Unified diffs Side-by-side diffs Delta from patch set Stats (+623 lines, -57 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
A worker/uniter/charm/deployer.go View 1 2 3 1 chunk +201 lines, -0 lines 0 comments Download
A worker/uniter/charm/deployer_test.go View 1 2 1 chunk +181 lines, -0 lines 0 comments Download
M worker/uniter/charm/git.go View 1 2 3 6 chunks +100 lines, -17 lines 0 comments Download
M worker/uniter/charm/git_test.go View 1 2 3 5 chunks +139 lines, -40 lines 0 comments Download

Messages

Total messages: 7
fwereade
Please take a look.
11 years, 8 months ago (2012-09-05 08:02:44 UTC) #1
fwereade
Please take a look.
11 years, 8 months ago (2012-09-05 09:19:34 UTC) #2
TheMue
LGTM, only one little note. https://codereview.appspot.com/6488084/diff/2001/worker/uniter/charm/deployer.go File worker/uniter/charm/deployer.go (right): https://codereview.appspot.com/6488084/diff/2001/worker/uniter/charm/deployer.go#newcode13 worker/uniter/charm/deployer.go:13: // Deployer maintains a ...
11 years, 8 months ago (2012-09-05 11:57:37 UTC) #3
niemeyer
Very nice. LGTM. https://codereview.appspot.com/6488084/diff/2001/worker/uniter/charm/deployer.go File worker/uniter/charm/deployer.go (right): https://codereview.appspot.com/6488084/diff/2001/worker/uniter/charm/deployer.go#newcode13 worker/uniter/charm/deployer.go:13: // Deployer maintains a git repository ...
11 years, 8 months ago (2012-09-05 22:47:21 UTC) #4
fwereade
Please take a look. https://codereview.appspot.com/6488084/diff/2001/worker/uniter/charm/deployer.go File worker/uniter/charm/deployer.go (right): https://codereview.appspot.com/6488084/diff/2001/worker/uniter/charm/deployer.go#newcode30 worker/uniter/charm/deployer.go:30: func (d *Deployer) SetCharm(bun *charm.Bundle, ...
11 years, 8 months ago (2012-09-06 08:18:04 UTC) #5
niemeyer
Thanks. Some additional details, and LGTM. https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/deployer.go File worker/uniter/charm/deployer.go (right): https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/deployer.go#newcode78 worker/uniter/charm/deployer.go:78: // Atomically rename ...
11 years, 8 months ago (2012-09-06 13:33:57 UTC) #6
fwereade
11 years, 8 months ago (2012-09-06 21:15:48 UTC) #7
*** Submitted:

add charm.Deployer; extend charm.GitDir

Deployer makes heavy use of GitDirs to implement the charm install/upgrade
procedures.

R=TheMue, niemeyer
CC=
https://codereview.appspot.com/6488084

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/deployer.go
File worker/uniter/charm/deployer.go (right):

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/deployer...
worker/uniter/charm/deployer.go:78: // Atomically rename temporary update
repository to current.
On 2012/09/06 13:33:57, niemeyer wrote:
> // Atomically rename fresh repository to current.

Done.

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/deployer...
worker/uniter/charm/deployer.go:189: prefix = prefix +
time.Now().Format("-%Y%m%d-%H%M%S")
On 2012/09/06 13:33:57, niemeyer wrote:
> var err error
> var path string

Done.

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/deployer...
worker/uniter/charm/deployer.go:192: if err := os.Mkdir(path, 0755); err != nil
{
On 2012/09/06 13:33:57, niemeyer wrote:
> if err = os.Mkdir(path, 0755); err == nil {
>         return path, nil
> } else if !os.IsExist(err) {
>         break
> }

Done.

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/deployer...
worker/uniter/charm/deployer.go:198: return "", fmt.Errorf("failed to create
deployer directory after 10 tries")
On 2012/09/06 13:33:57, niemeyer wrote:
> return "", fmt.Errorf("failed to create %q: %v", path, err)

Done.

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/git.go
File worker/uniter/charm/git.go (right):

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/git.go#n...
worker/uniter/charm/git.go:43: return false, fmt.Errorf("%s is not a directory",
d.path)
On 2012/09/06 13:33:57, niemeyer wrote:
> s/%s/%q/

Done.

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/git.go#n...
worker/uniter/charm/git.go:67: return d.cmd("reset", "--soft")
On 2012/09/06 13:33:57, niemeyer wrote:
> If this is strictly necessary after removing the lock, there's a race
condition
> above: someone else wins the race, deletes the file, dies == remove without
> reset.

Good point. Happily, it turns out reset --soft should be fine to run at any time
for our purposes, and it doesn't care about index.lock, so I now always reset
and then delete the lock.

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/git.go#n...
worker/uniter/charm/git.go:214: return nil, fmt.Errorf("git status failed: %s",
err)
On 2012/09/06 13:33:57, niemeyer wrote:
> I'm not sure if it makes a difference today, since there were changes pre-Go1,
> but we still use "%v" for err conventionally, I think.

Done.

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/git.go#n...
worker/uniter/charm/git.go:216: log.Printf(string(out))
On 2012/09/06 13:33:57, niemeyer wrote:
> Git's output as a *format*?
> 
> I guess this is even a left-over? It should go away, either way, as we don't
> want to the output of git on successes every time.

Crackhead nonsense -- it was useful for something at one point, and then the
tests started pasisng and I stopped seeing the logs :/. Sorry.

https://codereview.appspot.com/6488084/diff/8001/worker/uniter/charm/git.go#n...
worker/uniter/charm/git.go:224: cmd = exec.Command("git", "status")
On 2012/09/06 13:33:57, niemeyer wrote:
> Again!? Leftover?
Yep :(.
Sign in to reply to this message.

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