Skip to content

Commit

Permalink
Merge pull request #30 from Roblox/add_leading_slash_to_make_path_abs…
Browse files Browse the repository at this point in the history
…olute

Explicitly specify log directory root
  • Loading branch information
roberteckert authored Sep 17, 2024
2 parents f47d116 + f4b79c1 commit 68b8b2d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
9 changes: 5 additions & 4 deletions libraries/vault_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
2 changes: 1 addition & 1 deletion metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
15 changes: 8 additions & 7 deletions test/fixtures/policies/default.lock.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"revision_id": "cf88d87c2e217b43768c138a26d14d6f6aa42c90d5f9ef327d76b2da484ab99e",
"revision_id": "7f234aeea4304db41b948750f48a92a123f09633aa4819b3ac97662c9d0132d0",
"name": "default",
"run_list": [
"recipe[hashicorp-vault::default]"
Expand Down Expand Up @@ -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": {
Expand Down Expand Up @@ -200,7 +201,7 @@
"~> 5.0"
]
],
"hashicorp-vault (1002.7.14)": [
"hashicorp-vault (1002.8.2)": [
[
"build-essential",
">= 0.0.0"
Expand Down

0 comments on commit 68b8b2d

Please sign in to comment.