Permalink
Browse files

review feedback

  • Loading branch information...
1 parent 5241ccb commit a606cf68b519160750fcf7d2b55ce8169a2b005f @chipaca chipaca committed Nov 23, 2016
@@ -130,7 +130,7 @@ func init() {
// Trusted returns a copy of the current set of trusted assertions as used by Open.
func Trusted() []asserts.Assertion {
trusted := []asserts.Assertion(nil)
- if !osutil.EnvBool("SNAPPY_USE_STAGING_STORE") {
+ if !osutil.GetenvBool("SNAPPY_USE_STAGING_STORE") {
trusted = append(trusted, trustedAssertions...)
} else {
trusted = append(trusted, trustedStagingAssertions...)
View
@@ -55,7 +55,7 @@ func ExecInCoreSnap() {
return
}
- if !osutil.EnvBool(key) {
+ if !osutil.GetenvBool(key) {
return
}
View
@@ -252,7 +252,7 @@ func bootstrapToRootDir(sto Store, model *asserts.Model, opts *Options, local *l
f := makeFetcher(sto, &DownloadOptions{}, db)
if err := f.Save(model); err != nil {
- if !osutil.EnvBool("UBUNTU_IMAGE_SKIP_COPY_UNVERIFIED_MODEL") {
+ if !osutil.GetenvBool("UBUNTU_IMAGE_SKIP_COPY_UNVERIFIED_MODEL") {
return fmt.Errorf("cannot fetch and check prerequisites for the model assertion: %v", err)
} else {
logger.Noticef("Cannot fetch and check prerequisites for the model assertion, it will not be copied into the image: %v", err)
View
@@ -111,7 +111,7 @@ func (l *ConsoleLog) Debug(msg string) {
s := "DEBUG: " + msg
l.sys.Output(3, s)
- if osutil.EnvBool("SNAPD_DEBUG") {
+ if osutil.GetenvBool("SNAPD_DEBUG") {
l.log.Output(3, s)
}
}
View
@@ -24,9 +24,9 @@ import (
"strconv"
)
-// EnvBool returns whether the given key may be considered "set" in the environment
+// GetenvBool returns whether the given key may be considered "set" in the environment
// (i.e. it is set to one of "1", "true", etc)
-func EnvBool(key string) bool {
+func GetenvBool(key string) bool {
val := os.Getenv(key)
if val == "" {
return false
View
@@ -31,7 +31,7 @@ type envSuite struct{}
var _ = check.Suite(&envSuite{})
-func (s *envSuite) TestEnvBoolTrue(c *check.C) {
+func (s *envSuite) TestGetenvBoolTrue(c *check.C) {
key := "__XYZZY__"
os.Unsetenv(key)
@@ -40,20 +40,20 @@ func (s *envSuite) TestEnvBoolTrue(c *check.C) {
} {
os.Setenv(key, s)
c.Assert(os.Getenv(key), check.Equals, s)
- c.Check(osutil.EnvBool(key), check.Equals, true, check.Commentf(s))
+ c.Check(osutil.GetenvBool(key), check.Equals, true, check.Commentf(s))
}
}
-func (s *envSuite) TestEnvBoolFalse(c *check.C) {
+func (s *envSuite) TestGetenvBoolFalse(c *check.C) {
key := "__XYZZY__"
os.Unsetenv(key)
- c.Assert(osutil.EnvBool(key), check.Equals, false)
+ c.Assert(osutil.GetenvBool(key), check.Equals, false)
for _, s := range []string{
"", "0", "f", "FALSE", // etc
} {
os.Setenv(key, s)
c.Assert(os.Getenv(key), check.Equals, s)
- c.Check(osutil.EnvBool(key), check.Equals, false, check.Commentf(s))
+ c.Check(osutil.GetenvBool(key), check.Equals, false, check.Commentf(s))
}
}
@@ -360,7 +360,7 @@ func (m *DeviceManager) Stop() {
}
func useStaging() bool {
- return osutil.EnvBool("SNAPPY_USE_STAGING_STORE")
+ return osutil.GetenvBool("SNAPPY_USE_STAGING_STORE")
}
func deviceAPIBaseURL() string {
@@ -63,7 +63,7 @@ func (s *Snap) Install(targetPath, mountDir string) error {
// snap when we "install" a squashfs snap in the tests.
// We can not mount it for real in the tests, so we just unpack
// it to the location which is good enough for the tests.
- if osutil.EnvBool("SNAPPY_SQUASHFS_UNPACK_FOR_TESTS") {
+ if osutil.GetenvBool("SNAPPY_SQUASHFS_UNPACK_FOR_TESTS") {
if err := s.Unpack("*", mountDir); err != nil {
return err
}
@@ -45,7 +45,7 @@ func (loggerSuite) TearDownTest(c *check.C) {
}
func (s *loggerSuite) SetUpTest(c *check.C) {
- os.Setenv("SNAPD_DEBUG", "yes")
+ os.Setenv("SNAPD_DEBUG", "true")
s.logbuf = bytes.NewBuffer(nil)
l, err := logger.NewConsoleLog(s.logbuf, logger.DefaultFlags)
c.Assert(err, check.IsNil)
View
@@ -228,11 +228,11 @@ func getStructFields(s interface{}) []string {
}
func useDeltas() bool {
- return osutil.EnvBool("SNAPD_USE_DELTAS_EXPERIMENTAL")
+ return osutil.GetenvBool("SNAPD_USE_DELTAS_EXPERIMENTAL")
}
func useStaging() bool {
- return osutil.EnvBool("SNAPPY_USE_STAGING_STORE")
+ return osutil.GetenvBool("SNAPPY_USE_STAGING_STORE")
}
func cpiURL() string {

0 comments on commit a606cf6

Please sign in to comment.