Merge lp:~thumper/juju-core/fix-prepare-chown into lp:~go-bot/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Approved by: Tim Penhey
Approved revision: no longer in the source branch.
Merged at revision: 2260
Proposed branch: lp:~thumper/juju-core/fix-prepare-chown
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 54 lines (+0/-23)
1 file modified
environs/configstore/disk.go (+0/-23)
To merge this branch: bzr merge lp:~thumper/juju-core/fix-prepare-chown
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+203254@code.launchpad.net

Commit message

Remove chown from environ.configstore

The chown code was there primarily for the local provider.
This is no longer needed (and had a slight bug where it wasn't
actually checking to see if the current user was root before
trying to chown the files and dirs).

The code has simply been removed. I have tested this with
another user I have on my laptop and the local provider bootstraps
fine.

https://codereview.appspot.com/51150044/

Description of the change

Remove chown from environ.configstore

The chown code was there primarily for the local provider.
This is no longer needed (and had a slight bug where it wasn't
actually checking to see if the current user was root before
trying to chown the files and dirs).

The code has simply been removed. I have tested this with
another user I have on my laptop and the local provider bootstraps
fine.

https://codereview.appspot.com/51150044/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Reviewers: mp+203254_code.launchpad.net,

Message:
Please take a look.

Description:
Remove chown from environ.configstore

The chown code was there primarily for the local provider.
This is no longer needed (and had a slight bug where it wasn't
actually checking to see if the current user was root before
trying to chown the files and dirs).

The code has simply been removed. I have tested this with
another user I have on my laptop and the local provider bootstraps
fine.

https://code.launchpad.net/~thumper/juju-core/fix-prepare-chown/+merge/203254

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/51150044/

Affected files (+2, -23 lines):
   A [revision details]
   M environs/configstore/disk.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20140125125332-eckpnh62bygibitl
+New revision: <email address hidden>

Index: environs/configstore/disk.go
=== modified file 'environs/configstore/disk.go'
--- environs/configstore/disk.go 2014-01-22 22:48:54 +0000
+++ environs/configstore/disk.go 2014-01-26 19:19:03 +0000
@@ -58,20 +58,6 @@
   return filepath.Join(d.dir, "environments", envName+".jenv")
  }

-func ensurePathOwnedByUser(path string) error {
- uid, gid, err := utils.SudoCallerIds()
- if err != nil {
- return err
- }
- if uid != 0 {
- logger.Debugf("Making %v owned by %d:%d", path, uid, gid)
- if err := os.Chown(path, uid, gid); err != nil {
- return err
- }
- }
- return nil
-}
-
  func (d *diskStore) mkEnvironmentsDir() error {
   path := filepath.Join(d.dir, "environments")
   logger.Debugf("Making %v", path)
@@ -79,9 +65,6 @@
   if os.IsExist(err) {
    return nil
   }
- if err == nil {
- err = ensurePathOwnedByUser(path)
- }
   return err
  }

@@ -101,9 +84,6 @@
    return nil, err
   }
   file.Close()
- if err := ensurePathOwnedByUser(path); err != nil {
- return nil, err
- }
   return &environInfo{
    created: true,
    path: path,
@@ -203,9 +183,6 @@
    os.Remove(tmpFile.Name())
    return fmt.Errorf("cannot rename new environment info file: %v", err)
   }
- if err := ensurePathOwnedByUser(info.path); err != nil {
- return err
- }
   info.initialized = true
   return nil
  }

Revision history for this message
Dimiter Naydenov (dimitern) wrote :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'environs/configstore/disk.go'
2--- environs/configstore/disk.go 2014-01-22 22:48:54 +0000
3+++ environs/configstore/disk.go 2014-01-26 19:37:25 +0000
4@@ -58,20 +58,6 @@
5 return filepath.Join(d.dir, "environments", envName+".jenv")
6 }
7
8-func ensurePathOwnedByUser(path string) error {
9- uid, gid, err := utils.SudoCallerIds()
10- if err != nil {
11- return err
12- }
13- if uid != 0 {
14- logger.Debugf("Making %v owned by %d:%d", path, uid, gid)
15- if err := os.Chown(path, uid, gid); err != nil {
16- return err
17- }
18- }
19- return nil
20-}
21-
22 func (d *diskStore) mkEnvironmentsDir() error {
23 path := filepath.Join(d.dir, "environments")
24 logger.Debugf("Making %v", path)
25@@ -79,9 +65,6 @@
26 if os.IsExist(err) {
27 return nil
28 }
29- if err == nil {
30- err = ensurePathOwnedByUser(path)
31- }
32 return err
33 }
34
35@@ -101,9 +84,6 @@
36 return nil, err
37 }
38 file.Close()
39- if err := ensurePathOwnedByUser(path); err != nil {
40- return nil, err
41- }
42 return &environInfo{
43 created: true,
44 path: path,
45@@ -203,9 +183,6 @@
46 os.Remove(tmpFile.Name())
47 return fmt.Errorf("cannot rename new environment info file: %v", err)
48 }
49- if err := ensurePathOwnedByUser(info.path); err != nil {
50- return err
51- }
52 info.initialized = true
53 return nil
54 }

Subscribers

People subscribed via source and target branches

to status/vote changes: