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

Issue 24980043: Factor out container directory functions.

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 5 months ago by thumper
Modified:
10 years, 1 month ago
Reviewers:
mp+194780, natefinch
Visibility:
Public.

Description

Factor out container directory functions. Functions for dealing with the container definition directories are moved to the container package. https://code.launchpad.net/~thumper/juju-core/container-directory/+merge/194780 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 10
Unified diffs Side-by-side diffs Delta from patch set Stats (+160 lines, -53 lines) Patch
A [revision details] View 1 chunk +2 lines, -0 lines 0 comments Download
A container/directory.go View 1 chunk +72 lines, -0 lines 10 comments Download
A container/directory_test.go View 1 chunk +60 lines, -0 lines 0 comments Download
M container/lxc/lxc.go View 5 chunks +9 lines, -51 lines 0 comments Download
M container/lxc/testing/test.go View 2 chunks +3 lines, -2 lines 0 comments Download
A container/package_test.go View 1 chunk +14 lines, -0 lines 0 comments Download

Messages

Total messages: 3
thumper
Please take a look.
10 years, 5 months ago (2013-11-12 03:56:35 UTC) #1
natefinch
LGTM modulo some pretty trivial things. https://codereview.appspot.com/24980043/diff/1/container/directory.go File container/directory.go (right): https://codereview.appspot.com/24980043/diff/1/container/directory.go#newcode14 container/directory.go:14: RemovedContainerDir = "/var/lib/juju/removed-containers" ...
10 years, 5 months ago (2013-11-12 21:29:54 UTC) #2
thumper
10 years, 5 months ago (2013-11-12 21:57:51 UTC) #3
https://codereview.appspot.com/24980043/diff/1/container/directory.go
File container/directory.go (right):

https://codereview.appspot.com/24980043/diff/1/container/directory.go#newcode14
container/directory.go:14: RemovedContainerDir =
"/var/lib/juju/removed-containers"
On 2013/11/12 21:29:55, nate.finch wrote:
> Can you make these not exported and export them just for tests?  Sorta the
whole
> point of the encapsulation provided by these methods, right?

Unfortunately no, due to the tests being in other packages.

https://codereview.appspot.com/24980043/diff/1/container/directory.go#newcode19
container/directory.go:19: func NewContainerDirectory(containerName string)
(directory string, err error) {
On 2013/11/12 21:29:55, nate.finch wrote:
> Can we call this NewDirectory?  Seems redundant to have
> container.NewContainerDirectory

Yes we can.

https://codereview.appspot.com/24980043/diff/1/container/directory.go#newcode31
container/directory.go:31: func RemoveContainerDirectory(containerName string)
error {
On 2013/11/12 21:29:55, nate.finch wrote:
> I find the name RemoveContainerDirectory to be confusing, since it's not
> actually removing anything, just moving aside.
> Also, container.RemoveContainerDirectory(containerName) seems redundant.  Why
> not just container.RemoveDirectory(containerName)?

As far as the caller is concerned, it is removed :-).

Yes, name shortened.

https://codereview.appspot.com/24980043/diff/1/container/directory.go#newcode51
container/directory.go:51: func jujuContainerDirectory(containerName string)
string {
On 2013/11/12 21:29:55, nate.finch wrote:
> personally I'd call this something like dirForName or something...
> jujuContainerDirectory doesn't really tell me much (also I personally think
it's
> too long and makes the code harder to read... but I know others think
> otherwise).

dirForName should be fine, it is local to the file.

https://codereview.appspot.com/24980043/diff/1/container/directory.go#newcode57
container/directory.go:57: func uniqueDirectory(path, name string) (string,
error) {
On 2013/11/12 21:29:55, nate.finch wrote:
> Can this be put somewhere more generic?  Seems like something we might need to
> use quite often (I myself have written this same code at least 3 times in the
> past few years).

Moved into utils/file.go
Sign in to reply to this message.

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