Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local apt defaults #621

Merged
merged 7 commits into from Aug 28, 2014
Merged

Local apt defaults #621

merged 7 commits into from Aug 28, 2014

Conversation

kat-co
Copy link
Contributor

@kat-co kat-co commented Aug 27, 2014

For @howbazaar to correct local environment update/upgrade behavior when bootstrapping.

Running all tests locally now. I won't land unless they pass on my machine, but I wanted to get this up for review.

@kat-co
Copy link
Contributor Author

kat-co commented Aug 27, 2014

All tests are passing on my machine.

// Since Juju's state machine is currently the host machine
// for local providers, don't stomp on it.
setIfNot("enable-os-refresh-update", false)
setIfNot("enable-os-upgrade", false)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we only want to disable this for just the bootstrap node?

This looks like you are setting it for the entire environment.

// Since Juju's state machine is currently the host machine
// for local providers, don't stomp on it.
cfgAttrs := env.config.AllAttrs()
if _, ok := cfgAttrs["enable-os-refresh-update"]; !ok {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not pull the attr value out of the map here and then use it directly below? Instead of the env.config.EnableOSRefreshUpdate() call.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected, thanks!

logger.Infof("local provider; disabling refreshing OS updates.")
mcfg.EnableOSRefreshUpdate = false
} else {
mcfg.EnableOSRefreshUpdate = val.(bool)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My preference would be for the .(bool) to go up to the map access:
val, ok := cfgAttrs["enable-os-refresh-update"].(bool)

This will avoid any panics due to cast errors, and sort of fails safe because if there's a problem, we set update to false

s.testBootstrap(c, minCfg)

// Test that overrides work.
minCfg, err := minCfg.Apply(map[string]interface{}{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this assign to a new minCfg object? Not sure, but it could be that the mockFinish method will still be using the original minCfg values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wallyworld
Copy link
Member

LGTM

@kat-co
Copy link
Contributor Author

kat-co commented Aug 28, 2014

$$merge$$

@jujubot
Copy link
Collaborator

jujubot commented Aug 28, 2014

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

jujubot added a commit that referenced this pull request Aug 28, 2014
Local apt defaults

For @howbazaar to correct local environment update/upgrade behavior when bootstrapping.

Running all tests locally now. I won't land unless they pass on my machine, but I wanted to get this up for review.
@jujubot jujubot merged commit 6a5cf8c into juju:master Aug 28, 2014
@kat-co kat-co deleted the local-apt-defaults branch August 28, 2014 01:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants