-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only install relevant GPG Keys (#930)
* feat(recipes): install only relevant gpg keys * fix(style): floating whitespace removal * test(dd-agent_spec): test gpg key correct installation * feat(lint): fix linting issue * feat(gpg): add kitchen tests to check gpg keys * feat(kitchen): add dd-agent-gpgcheck to ci tests * feat(kitchen): gpgcheck tests excluding agent 5 oses * feat(kitchen): gpgcheck add dd-handler * feat(chef): pin old version to 7.20.0 * feat(handler): enable chef handler * feat(rework): rpm gpg import * debug * feat(agent_minor_version): fix agent_minor_version * feat(agent_minor_version): fix agent_minor_version * feat(agent_minor_version): fix agent_minor_version * feat(agent_minor_version): fix agent_minor_version * feat(agent_minor_version): fix agent_minor_version * feat(agent_minor_version): debug agent_minor_version * feat(agent_minor_version): debug agent_minor_version * feat(agent_minor_version): debug agent_minor_version * feat(agent_minor_version): debug agent_minor_version * feat(agent_minor_version): debug agent_minor_version * feat(agent_minor_version): wrong condition priority * feat(agent_minor_version): wrong condition priority * feat(spec): update specs with removed gpg keys * feat(serverspec): fix serverspec tests * feat(kitchen): wrong indentation * feat(comment): apply PR comments
- Loading branch information
Showing
14 changed files
with
227 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
test/integration/dd-agent-gpgcheck-older/serverspec_datadog/Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
source 'https://rubygems.org' | ||
|
||
chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') | ||
|
||
if RUBY_VERSION < '2.6' | ||
gem 'net-ssh', '~> 6.1.0' | ||
gem 'public_suffix', '~> 4.0.0' | ||
end | ||
|
||
gem 'json_spec', '~> 1.1.0' | ||
|
||
if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' | ||
gem 'train-core', '~> 3.9.0' | ||
end |
53 changes: 53 additions & 0 deletions
53
test/integration/dd-agent-gpgcheck-older/serverspec_datadog/dd-agent_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Copyright:: 2011-Present, Datadog | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require 'spec_helper' | ||
|
||
describe package(@agent_package_name) do | ||
it { should be_installed } | ||
end | ||
|
||
describe service(@agent_service_name) do | ||
it { should be_running } | ||
end | ||
|
||
describe command('/opt/datadog-agent/bin/agent/agent status | grep -v "Instance ID"'), :if => os[:family] != 'windows' do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain '[OK]' } | ||
its(:stdout) { should_not contain 'ERROR' } | ||
end | ||
|
||
# The new APT keys are imported | ||
describe command('apt-key list'), :if => ['debian', 'ubuntu'].include?(os[:family]) do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain 'C0962C7D' } | ||
its(:stdout) { should contain 'F14F620E' } | ||
its(:stdout) { should contain '382E94DE' } | ||
end | ||
|
||
# The new RPM keys are imported | ||
describe command('rpm -q gpg-pubkey-b01082d3'), :if => os[:family] == 'redhat' do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain 'gpg-pubkey-b01082d3' } | ||
end | ||
|
||
describe command('rpm -q gpg-pubkey-fd4bf915'), :if => os[:family] == 'redhat' do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain 'gpg-pubkey-fd4bf915' } | ||
end | ||
|
||
describe command('rpm -q gpg-pubkey-e09422b3'), :if => os[:family] == 'redhat' do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain 'gpg-pubkey-e09422b3' } | ||
end |
20 changes: 20 additions & 0 deletions
20
test/integration/dd-agent-gpgcheck-older/serverspec_datadog/dd-handler_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright:: 2011-Present, Datadog | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require 'spec_helper' | ||
|
||
# the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec | ||
describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do | ||
it { should be_installed.by('gem') } | ||
end |
14 changes: 14 additions & 0 deletions
14
test/integration/dd-agent-gpgcheck-recent/serverspec_datadog/Gemfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
source 'https://rubygems.org' | ||
|
||
chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') | ||
|
||
if RUBY_VERSION < '2.6' | ||
gem 'net-ssh', '~> 6.1.0' | ||
gem 'public_suffix', '~> 4.0.0' | ||
end | ||
|
||
gem 'json_spec', '~> 1.1.0' | ||
|
||
if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' | ||
gem 'train-core', '~> 3.9.0' | ||
end |
52 changes: 52 additions & 0 deletions
52
test/integration/dd-agent-gpgcheck-recent/serverspec_datadog/dd-agent_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Copyright:: 2011-Present, Datadog | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require 'spec_helper' | ||
|
||
describe package(@agent_package_name) do | ||
it { should be_installed } | ||
end | ||
|
||
describe service(@agent_service_name) do | ||
it { should be_running } | ||
end | ||
|
||
describe command('/opt/datadog-agent/bin/agent/agent status | grep -v "Instance ID"'), :if => os[:family] != 'windows' do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain '[OK]' } | ||
its(:stdout) { should_not contain 'ERROR' } | ||
end | ||
|
||
# The new APT keys are imported | ||
describe command('apt-key list'), :if => ['debian', 'ubuntu'].include?(os[:family]) do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain 'C0962C7D' } | ||
its(:stdout) { should contain 'F14F620E' } | ||
its(:stdout) { should contain '382E94DE' } | ||
end | ||
|
||
# The new RPM keys are imported | ||
describe command('rpm -q gpg-pubkey-b01082d3'), :if => os[:family] == 'redhat' do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain 'gpg-pubkey-b01082d3' } | ||
end | ||
|
||
describe command('rpm -q gpg-pubkey-fd4bf915'), :if => os[:family] == 'redhat' do | ||
its(:exit_status) { should eq 0 } | ||
its(:stdout) { should contain 'gpg-pubkey-fd4bf915' } | ||
end | ||
|
||
describe command('rpm -q gpg-pubkey-e09422b3'), :if => os[:family] == 'redhat' do | ||
its(:exit_status) { should eq 1 } | ||
end |
20 changes: 20 additions & 0 deletions
20
test/integration/dd-agent-gpgcheck-recent/serverspec_datadog/dd-handler_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright:: 2011-Present, Datadog | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require 'spec_helper' | ||
|
||
# the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec | ||
describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do | ||
it { should be_installed.by('gem') } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.