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

[URGENT] Fix two regressions in version 3.0.0 #12

Merged
merged 1 commit into from
Aug 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions manifests/config.pp
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@

# Determine the directory for the chosen binary provider.
if ($binary_provider_type == 'file-system') and ! $::artifactory::binary_provider_filesystem_dir {
$mapped_provider_filesystem_dir = 'filestore'
} else {
$mapped_provider_filesystem_dir = $::artifactory::binary_provider_filesystem_dir
}
if $::artifactory::binary_provider_base_data_dir {
$binary_provider_filesystem_dir = "${::artifactory::binary_provider_base_data_dir}/${mapped_provider_filesystem_dir}"
if $::artifactory::binary_provider_base_data_dir {
$binary_provider_filesystem_dir = "${::artifactory::binary_provider_base_data_dir}/filestore"
} else {
$binary_provider_filesystem_dir = undef
}
} elsif ($binary_provider_type == 'file-system') and $::artifactory::binary_provider_filesystem_dir {
$binary_provider_filesystem_dir = $::artifactory::binary_provider_filesystem_dir
} else {
$binary_provider_filesystem_dir = undef
}
Expand Down
64 changes: 61 additions & 3 deletions spec/classes/artifactory_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -169,19 +169,77 @@
}
end

context 'artifactory class with version specified' do
context 'running a legacy version (pre v7)' do
let(:params) do
{
'package_version' => '5.9.1',
'package_version' => '6.0.0',
}
end

it { is_expected.to compile.with_all_deps }
it {
is_expected.to contain_package('jfrog-artifactory-oss').with(
'ensure' => '5.9.1',
'ensure' => '6.0.0',
)
}
it {
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/binarystore.xml').with_content(%r{chain template="file-system"})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/binarystore.xml').without_content(%r{<provider id="file-system" type="file-system">})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/binarystore.xml').without_content(%r{<fileStoreDir>})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/binarystore.xml').without_content(%r{<baseDataDir>})
}
end

context 'running a current version' do
let(:params) do
{
'package_version' => '7.4.3',
}
end

it { is_expected.to compile.with_all_deps }
it {
is_expected.to contain_package('jfrog-artifactory-oss').with(
'ensure' => '7.4.3',
)
}
it {
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{chain template="file-system"})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').without_content(%r{<provider id="file-system" type="file-system">})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').without_content(%r{<fileStoreDir>})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').without_content(%r{<baseDataDir>})
}
end

context 'running a current version with a custom binary filesystem dir' do
let(:params) do
{
'package_version' => '7.4.3',
'binary_provider_filesystem_dir' => '/opt/artifactory-filestore',
}
end

it { is_expected.to compile.with_all_deps }
it {
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{<provider id="file-system" type="file-system">})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{<fileStoreDir>/opt/artifactory-filestore</fileStoreDir>})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').without_content(%r{<baseDataDir>})
}
end

context 'running a current version with a custom binary base data dir' do
let(:params) do
{
'package_version' => '7.4.3',
'binary_provider_base_data_dir' => '/opt/artifactory-data',
}
end

it { is_expected.to compile.with_all_deps }
it {
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{<baseDataDir>/opt/artifactory-data</baseDataDir>})
is_expected.to contain_file('/var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml').with_content(%r{<fileStoreDir>/opt/artifactory-data/filestore</fileStoreDir>})
}
end
end
end
Expand Down
16 changes: 8 additions & 8 deletions templates/binarystore.xml.epp
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,33 @@

<config version="1">
<chain template="<%= $binary_provider_type %>"/>
<% if $binary_provider_type == 'filesystem'
<% if $binary_provider_type == 'file-system'
and ($binary_provider_base_data_dir or $binary_provider_filesystem_dir)
or $binary_provider_type == 'cachedFS'
or $binary_provider_type == 'cache-fs'
and ($binary_provider_cache_dir or $binary_provider_cache_maxsize) { -%>
<provider id="<%= $binary_provider_type %>" type="<%= $binary_provider_type %>">
<% if $binary_provider_type == 'filesystem'
<% if $binary_provider_type == 'file-system'
and $binary_provider_base_data_dir { -%>
<baseDataDir><%= $binary_provider_base_data_dir %></baseDataDir>
<% } -%>
<% if $binary_provider_type == 'filesystem'
<% if $binary_provider_type == 'file-system'
and $binary_provider_filesystem_dir { -%>
<fileStoreDir><%= $binary_provider_filesystem_dir %></fileStoreDir>
<% } -%>
<% if $binary_provider_type == 'cachedFS'
<% if $binary_provider_type == 'cache-fs'
and $binary_provider_cache_maxsize { -%>
<maxCacheSize><%= $binary_provider_cache_maxsize %></maxCacheSize>
<% } -%>
<% if $binary_provider_type == 'cachedFS'
<% if $binary_provider_type == 'cache-fs'
and $binary_provider_cache_dir { -%>
<cacheProviderDir><%= $binary_provider_cache_dir %></cacheProviderDir>
<% } -%>
</provider>
<% } elsif $binary_provider_type == 'fullDb' { -%>
<% } elsif $binary_provider_type == 'full-db' { -%>
<provider id="cache-fs" type="cache-fs">
<provider id="blob" type="blob"/>
</provider>
<% } elsif $binary_provider_type == 'fullDbDirect' { -%>
<% } elsif $binary_provider_type == 'full-db-direct' { -%>
<provider id="blob" type="blob"/>
<% } -%>
</config>