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

Check if data-dir is a directory #2529

Merged
merged 2 commits into from
Dec 15, 2016
Merged

Conversation

mckennajones
Copy link
Contributor

fix for #1838

@babbottscott
Copy link

imho, If an app is told to use a directory and has the perms to create it, it should attempt to create it if missing. Nothing more frustrating than that one box out of thirty where someone made a boneheaded manual change that laid a timebomb your service can't recover from.

@mckennajones
Copy link
Contributor Author

@babbottscott Thoughts on this @slackpad ? It wouldn't be hard to implement but I'm not sure if this is the intended behavior for this case.

@slackpad
Copy link
Contributor

@mckennajones @babbottscott That's a good suggestion in general, but I'd keep the current behavior for Consul and not auto-create the directory. We use the presence of state in that directory to tell if a cluster is fresh and whether it's safe to bootstrap, for example, so I'd rather be conservative and have it error out. For non-servers it might be safe to create it on the fly, but that's probably too subtle/complex to have a behavior difference.

@slackpad slackpad added this to the 0.7.2 milestone Nov 30, 2016
@@ -209,6 +209,12 @@ func (c *Command) readConfig() *Config {
return nil
}

if finfo, _ := os.Stat(config.DataDir); !finfo.IsDir() {
Copy link
Contributor

Choose a reason for hiding this comment

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

We should handle the error here in case they gave an invalid path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kyhavlov What are you suggesting differently than what I have done?

@kyhavlov kyhavlov merged commit cb96aa8 into hashicorp:master Dec 15, 2016
slackpad added a commit that referenced this pull request Dec 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants