From f4b79c1667203d2f70917d958c015f149860d37d Mon Sep 17 00:00:00 2001 From: Robert Eckert Date: Tue, 17 Sep 2024 10:06:11 -0700 Subject: [PATCH] Explicitly specify log directory root --- libraries/vault_service.rb | 9 +++++---- metadata.rb | 2 +- test/fixtures/policies/default.lock.json | 15 ++++++++------- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/libraries/vault_service.rb b/libraries/vault_service.rb index 845defd..714b98c 100644 --- a/libraries/vault_service.rb +++ b/libraries/vault_service.rb @@ -86,16 +86,17 @@ def action_enable end # if /data directory mounted then we need to symlink /var/log/vault to /data/var/log/vault - log_path = ::File.join('var', 'log', 'vault') - if ::File.directory?('/data') + log_path = ::File.join('/', 'var', 'log', 'vault') + data_root_path = ::File.join('/', 'data') + if ::File.directory?(data_root_path) # if /var/log/vault exists and is not a link, move to /var/log/vault.[created_at timestamp] - data_path = ::File.join('data', log_path) + data_log_path = ::File.join(data_root_path, log_path) if ::File.directory?(log_path) && !::File.symlink?(log_path) created_at = ::File.ctime(log_path).strftime('%Y%m%d%H%M%S') new_path = ::File.join(log_path, created_at) ::FileUtils.mv(log_path, new_path) end - directory data_path do + directory data_log_path do owner new_resource.user group new_resource.group mode '0750' diff --git a/metadata.rb b/metadata.rb index 56bf492..950cf72 100644 --- a/metadata.rb +++ b/metadata.rb @@ -6,7 +6,7 @@ long_description 'Application cookbook for installing and configuring Vault.' issues_url 'https://github.com/johnbellone/vault-cookbook/issues' source_url 'https://github.com/johnbellone/vault-cookbook/' -version '1002.8.2' +version '1002.8.3' supports 'ubuntu', '>= 12.04' supports 'redhat', '>= 6.4' diff --git a/test/fixtures/policies/default.lock.json b/test/fixtures/policies/default.lock.json index f43601e..eb07610 100644 --- a/test/fixtures/policies/default.lock.json +++ b/test/fixtures/policies/default.lock.json @@ -1,5 +1,5 @@ { - "revision_id": "cf88d87c2e217b43768c138a26d14d6f6aa42c90d5f9ef327d76b2da484ab99e", + "revision_id": "7f234aeea4304db41b948750f48a92a123f09633aa4819b3ac97662c9d0132d0", "name": "default", "run_list": [ "recipe[hashicorp-vault::default]" @@ -42,19 +42,20 @@ } }, "hashicorp-vault": { - "version": "1002.7.14", - "identifier": "43b55d582607b499299d4ab83675d312ac31bea1", - "dotted_decimal_identifier": "19058235955087284.43111426976921205.232077151813281", + "version": "1002.8.2", + "identifier": "17e8b4f68f71d07a0f1f06c70f678074ce2f3685", + "dotted_decimal_identifier": "6729788392698320.34356573090811751.141239163762309", "source": "../../..", "cache_key": null, "scm_info": { "scm": "git", "remote": null, - "revision": "8ad3efdd3d6ac6282438455d6d962763419f0368", + "revision": "f47d116493f819158c43f09d9ba0eaf74e4b78b4", "working_tree_clean": false, "published": true, "synchronized_remote_branches": [ - "origin/create_var_log_vault_directory_in_cookbook" + "origin/HEAD -> origin/master", + "origin/master" ] }, "source_options": { @@ -200,7 +201,7 @@ "~> 5.0" ] ], - "hashicorp-vault (1002.7.14)": [ + "hashicorp-vault (1002.8.2)": [ [ "build-essential", ">= 0.0.0"