Change file resource to exec
This commit changes the way the JAVA_HOME variable is added to /etc/environment from using a file resource to using an exec resource. This way we can avoid resource conflicts with the file. Signed-off-by: Nate Potter <ntpttr@gmail.com>
This commit is contained in:
@@ -10,8 +10,10 @@ class java::config ( ) {
|
||||
}
|
||||
}
|
||||
if $java::use_java_home != undef {
|
||||
file { '/etc/environment':
|
||||
content => inline_template("JAVA_HOME=${$java::use_java_home}"),
|
||||
exec { 'java-home-environment':
|
||||
path => '/bin',
|
||||
user => 'root',
|
||||
command => "echo JAVA_HOME=${$java::use_java_home} >> /etc/environment",
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -35,36 +37,46 @@ class java::config ( ) {
|
||||
}
|
||||
}
|
||||
if $java::use_java_home != undef {
|
||||
file { '/etc/environment':
|
||||
content => inline_template("JAVA_HOME=${$java::use_java_home}"),
|
||||
exec { 'java-home-environment':
|
||||
path => '/bin',
|
||||
user => 'root',
|
||||
command => "echo JAVA_HOME=${$java::use_java_home} >> /etc/environment",
|
||||
}
|
||||
}
|
||||
}
|
||||
'OpenBSD': {
|
||||
if $java::use_java_home != undef {
|
||||
file { '/etc/environment':
|
||||
content => inline_template("JAVA_HOME=${$java::use_java_home}"),
|
||||
exec { 'java-home-environment':
|
||||
path => '/bin',
|
||||
user => 'root',
|
||||
command => "echo JAVA_HOME=${$java::use_java_home} >> /etc/environment",
|
||||
}
|
||||
}
|
||||
}
|
||||
'FreeBSD': {
|
||||
if $java::use_java_home != undef {
|
||||
file { '/etc/environment':
|
||||
content => inline_template("JAVA_HOME=${$java::use_java_home}"),
|
||||
exec { 'java-home-environment':
|
||||
path => '/bin',
|
||||
user => 'root',
|
||||
command => "echo JAVA_HOME=${$java::use_java_home} >> /etc/environment",
|
||||
}
|
||||
}
|
||||
}
|
||||
'Suse': {
|
||||
if $java::use_java_home != undef {
|
||||
file { '/etc/environment':
|
||||
content => inline_template("JAVA_HOME=${$java::use_java_home}"),
|
||||
exec { 'java-home-environment':
|
||||
path => '/bin',
|
||||
user => 'root',
|
||||
command => "echo JAVA_HOME=${$java::use_java_home} >> /etc/environment",
|
||||
}
|
||||
}
|
||||
}
|
||||
'Solaris': {
|
||||
if $java::use_java_home != undef {
|
||||
file { '/etc/environment':
|
||||
content => inline_template("JAVA_HOME=${$java::use_java_home}"),
|
||||
exec { 'java-home-environment':
|
||||
path => '/bin',
|
||||
user => 'root',
|
||||
command => "echo JAVA_HOME=${$java::use_java_home} >> /etc/environment",
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,29 +5,29 @@ describe 'java', :type => :class do
|
||||
context 'select openjdk for Centos 5.8' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.8', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-x86_64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.6.0-openjdk-x86_64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Centos 6.3' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Centos 7.1.1503' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '7.1.1503', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-x86_64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-x86_64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Centos 6.2' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.2'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.2', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
it { is_expected.to_not contain_exec('update-java-alternatives') }
|
||||
end
|
||||
|
||||
context 'select Oracle JRE with alternatives for Centos 6.3' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '6.3', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'package' => 'jre', 'java_alternative' => '/usr/bin/java', 'java_alternative_path' => '/usr/java/jre1.7.0_67/bin/java'} }
|
||||
it { is_expected.to contain_package('java').with_name('jre') }
|
||||
it { is_expected.to contain_exec('create-java-alternatives').with_command('alternatives --install /usr/bin/java java /usr/java/jre1.7.0_67/bin/java 20000') }
|
||||
@@ -37,45 +37,45 @@ describe 'java', :type => :class do
|
||||
context 'select openjdk for Fedora 20' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Fedora 21' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-x86_64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-x86_64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora 20' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '20', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'distribution' => 'jre', 'java_home' => '/usr/local/lib/jre/' } }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/local/lib/jre/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/local/lib/jre/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora 21' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} }
|
||||
let(:params) { { 'distribution' => 'jre', 'java_home' => '/usr/local/lib/jre' } }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'distribution' => 'jre', 'java_home' => '/usr/local/lib/jre/' } }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.8.0-openjdk') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/local/lib/jre') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/local/lib/jre/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select passed value for Fedora 21 with yum option' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Fedora', :operatingsystemrelease => '21', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
let(:params) { { 'package_options' => ['--skip-broken'] } }
|
||||
it { is_expected.to contain_package('java') }
|
||||
end
|
||||
|
||||
context 'select passed value for Centos 5.3' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'package' => 'jdk', 'java_home' => '/usr/local/lib/jre' } }
|
||||
it { is_expected.to contain_package('java').with_name('jdk') }
|
||||
it { is_expected.to_not contain_exec('update-java-alternatives') }
|
||||
end
|
||||
|
||||
context 'select default for Centos 5.3' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Centos', :operatingsystemrelease => '5.3', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
it { is_expected.to_not contain_exec('update-java-alternatives') }
|
||||
end
|
||||
@@ -84,7 +84,7 @@ describe 'java', :type => :class do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Debian', :lsbdistcodename => 'wheezy', :operatingsystemrelease => '7.1', :architecture => 'amd64',} }
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-7-jdk') }
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select Oracle JRE for Debian Wheezy' do
|
||||
@@ -92,7 +92,7 @@ describe 'java', :type => :class do
|
||||
let(:params) { { 'distribution' => 'oracle-jre' } }
|
||||
it { is_expected.to contain_package('java').with_name('oracle-j2re1.7') }
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set j2re1.7-oracle --jre') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/j2re1.7-oracle/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/j2re1.7-oracle/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select OpenJDK JRE for Debian Wheezy' do
|
||||
@@ -100,7 +100,7 @@ describe 'java', :type => :class do
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-7-jre-headless') }
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-1.7.0-openjdk-amd64 --jre-headless') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-amd64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select default for Debian Squeeze' do
|
||||
@@ -114,7 +114,7 @@ describe 'java', :type => :class do
|
||||
let(:params) { { 'distribution' => 'sun-jre', } }
|
||||
it { is_expected.to contain_package('java').with_name('sun-java6-jre') }
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-sun --jre') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select OpenJDK JRE for Debian Squeeze' do
|
||||
@@ -122,7 +122,7 @@ describe 'java', :type => :class do
|
||||
let(:params) { { 'distribution' => 'jre', } }
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-6-jre-headless') }
|
||||
it { is_expected.to contain_exec('update-java-alternatives').with_command('update-java-alternatives --set java-6-openjdk-amd64 --jre-headless') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-6-openjdk/jre/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select random alternative for Debian Wheezy' do
|
||||
@@ -136,40 +136,40 @@ describe 'java', :type => :class do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} }
|
||||
let(:params) { { 'distribution' => 'jdk' } }
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-8-jdk') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select jre for Ubuntu Vivid (15.04)' do
|
||||
let(:facts) { {:osfamily => 'Debian', :operatingsystem => 'Ubuntu', :lsbdistcodename => 'vivid', :operatingsystemrelease => '15.04', :architecture => 'amd64',} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { is_expected.to contain_package('java').with_name('openjdk-8-jre-headless') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-amd64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Amazon Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '3.4.43-43.43.amzn1.x86_64', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select passed value for Amazon Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '5.3.4.43-43.43.amzn1.x86_64'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Amazon', :operatingsystemrelease => '5.3.4.43-43.43.amzn1.x86_64', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Oracle Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.4'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.4', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select openjdk for Oracle Linux 6.2' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.2'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.2', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.6.0-openjdk-devel') }
|
||||
end
|
||||
|
||||
context 'select passed value for Oracle Linux' do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.3'} }
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'OracleLinux', :operatingsystemrelease => '6.3', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
end
|
||||
@@ -178,41 +178,41 @@ describe 'java', :type => :class do
|
||||
let(:facts) { {:osfamily => 'RedHat', :operatingsystem => 'Scientific', :operatingsystemrelease => '6.4', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { is_expected.to contain_package('java').with_name('java-1.7.0-openjdk') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-x86_64/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select default for OpenSUSE 12.3' do
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'OpenSUSE', :operatingsystemrelease => '12.3'}}
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'OpenSUSE', :operatingsystemrelease => '12.3', :architecture => 'x86_64'}}
|
||||
it { is_expected.to contain_package('java').with_name('java-1_7_0-openjdk-devel')}
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select default for SLES 11.3' do
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'SLES', :operatingsystemrelease => '11.3'}}
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'SLES', :operatingsystemrelease => '11.3', :architecture => 'x86_64'}}
|
||||
it { should contain_package('java').with_name('java-1_6_0-ibm-devel')}
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib64/jvm/java-1.6.0-ibm-1.6.0/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib64/jvm/java-1.6.0-ibm-1.6.0/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select default for SLES 11.4' do
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'SLES', :operatingsystemrelease => '11.4'}}
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'SLES', :operatingsystemrelease => '11.4', :architecture => 'x86_64'}}
|
||||
it { should contain_package('java').with_name('java-1_7_0-ibm-devel')}
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib64/jvm/java-1.7.0-ibm-1.7.0/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib64/jvm/java-1.7.0-ibm-1.7.0/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select default for SLES 12.1' do
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'SLES', :operatingsystemrelease => '12.1', :operatingsystemmajrelease => '12'}}
|
||||
let(:facts) { {:osfamily => 'Suse', :operatingsystem => 'SLES', :operatingsystemrelease => '12.1', :operatingsystemmajrelease => '12', :architecture => 'x86_64'}}
|
||||
it { should contain_package('java').with_name('java-1_7_0-openjdk-devel')}
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/lib64/jvm/java-1.7.0-openjdk-1.7.0/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select jdk for OpenBSD' do
|
||||
let(:facts) { {:osfamily => 'OpenBSD'} }
|
||||
let(:facts) { {:osfamily => 'OpenBSD', :architecture => 'x86_64'} }
|
||||
it { is_expected.to contain_package('java').with_name('jdk') }
|
||||
it { is_expected.to contain_file('/etc/environment').with_content('JAVA_HOME=/usr/local/jdk/') }
|
||||
it { is_expected.to contain_exec('java-home-environment').with_command('echo JAVA_HOME=/usr/local/jdk/ >> /etc/environment') }
|
||||
end
|
||||
|
||||
context 'select jre for OpenBSD' do
|
||||
let(:facts) { {:osfamily => 'OpenBSD'} }
|
||||
let(:facts) { {:osfamily => 'OpenBSD', :architecture => 'x86_64'} }
|
||||
let(:params) { { 'distribution' => 'jre' } }
|
||||
it { is_expected.to contain_package('java').with_name('jre') }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user