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

fix: Ensure working dir for bloomstore exists #12019

Merged
merged 5 commits into from
Feb 22, 2024

Conversation

chaudum
Copy link
Contributor

@chaudum chaudum commented Feb 21, 2024

What this PR does / why we need it:

Fail startup if directory does not exist or there are not enough permissions. This prevents the bloomstore to fail later in the process once it tries to download and extract blocks.

@chaudum chaudum requested a review from a team as a code owner February 21, 2024 11:00
@chaudum chaudum changed the title Ensure working dir for bloomstore exists fix: Ensure working dir for bloomstore exists Feb 21, 2024
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
@chaudum chaudum force-pushed the chaudum/ensure-bloomstore-dir branch from 037c0b5 to f54afc8 Compare February 22, 2024 09:01
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
@@ -72,6 +72,8 @@ func EnsureDirectory(dir string) error {
return os.MkdirAll(dir, 0o777)
} else if err == nil && !info.IsDir() {
return fmt.Errorf("not a directory: %s", dir)
} else if err == nil && info.Mode()&0700 != 0700 {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd maybe set these 0700 masks as const describing which permissions they set.

@chaudum chaudum merged commit b9ce005 into main Feb 22, 2024
11 checks passed
@chaudum chaudum deleted the chaudum/ensure-bloomstore-dir branch February 22, 2024 09:41
onelapahead pushed a commit to onelapahead/loki that referenced this pull request Feb 22, 2024
Fail startup if directory does not exist or there are not enough permissions. This prevents the bloomstore to fail later in the process once it tries to download and extract blocks.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
onelapahead pushed a commit to onelapahead/loki that referenced this pull request Feb 22, 2024
Fail startup if directory does not exist or there are not enough permissions. This prevents the bloomstore to fail later in the process once it tries to download and extract blocks.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
rhnasc pushed a commit to inloco/loki that referenced this pull request Apr 12, 2024
Fail startup if directory does not exist or there are not enough permissions. This prevents the bloomstore to fail later in the process once it tries to download and extract blocks.

Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants