mirror of
https://github.com/inspec/inspec
synced 2024-11-22 20:53:11 +00:00
rename old deprecations that were meant for 1.0
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
parent
c3ab00f74c
commit
144dede6eb
2 changed files with 7 additions and 7 deletions
|
@ -70,7 +70,7 @@ end
|
|||
# matcher to check /etc/passwd, /etc/shadow and /etc/group
|
||||
RSpec::Matchers.define :contain_legacy_plus do
|
||||
match do |file|
|
||||
warn '[DEPRECATION] `contain_legacy_plus` is deprecated and will be removed for InSpec 1.0. Please use `describe file(\'/etc/passwd\') do its(\'content\') { should_not match /^\+:/ } end`'
|
||||
warn '[DEPRECATION] `contain_legacy_plus` is deprecated and will be removed in the next major version. Please use `describe file(\'/etc/passwd\') do its(\'content\') { should_not match /^\+:/ } end`'
|
||||
file.content =~ /^\+:/
|
||||
end
|
||||
end
|
||||
|
@ -78,7 +78,7 @@ end
|
|||
# verifies that no entry in an array contains a value
|
||||
RSpec::Matchers.define :contain_match do |regex|
|
||||
match do |arr|
|
||||
warn '[DEPRECATION] `contain_match` is deprecated and will be removed for InSpec 1.0. See https://github.com/chef/inspec/issues/738 for more details'
|
||||
warn '[DEPRECATION] `contain_match` is deprecated and will be removed in the next major version. See https://github.com/chef/inspec/issues/738 for more details'
|
||||
arr.inject { |result, i|
|
||||
result = i.match(regex)
|
||||
result || i.match(/$/)
|
||||
|
@ -88,7 +88,7 @@ end
|
|||
|
||||
RSpec::Matchers.define :contain_duplicates do
|
||||
match do |arr|
|
||||
warn '[DEPRECATION] `contain_duplicates` is deprecated and will be removed for InSpec 1.0. See https://github.com/chef/inspec/issues/738 for more details'
|
||||
warn '[DEPRECATION] `contain_duplicates` is deprecated and will be removed in the next major version. See https://github.com/chef/inspec/issues/738 for more details'
|
||||
dup = arr.select { |element| arr.count(element) > 1 }
|
||||
!dup.uniq.empty?
|
||||
end
|
||||
|
|
|
@ -62,17 +62,17 @@ module Inspec::Resources
|
|||
.add(:shells, field: 'shell')
|
||||
|
||||
filter.add(:count) { |t, _|
|
||||
warn '[DEPRECATION] `passwd.count` is deprecated. Please use `passwd.entries.length` instead. It will be removed in version 1.0.0.'
|
||||
warn '[DEPRECATION] `passwd.count` is deprecated. Please use `passwd.entries.length` instead. It will be removed in the next major version.'
|
||||
t.entries.length
|
||||
}
|
||||
|
||||
filter.add(:usernames) { |t, x|
|
||||
warn '[DEPRECATION] `passwd.usernames` is deprecated. Please use `passwd.users` instead. It will be removed in version 1.0.0.'
|
||||
warn '[DEPRECATION] `passwd.usernames` is deprecated. Please use `passwd.users` instead. It will be removed in the next major version.'
|
||||
t.users(x)
|
||||
}
|
||||
|
||||
filter.add(:username) { |t, x|
|
||||
warn '[DEPRECATION] `passwd.username` is deprecated. Please use `passwd.users` instead. It will be removed in version 1.0.0.'
|
||||
warn '[DEPRECATION] `passwd.username` is deprecated. Please use `passwd.users` instead. It will be removed in the next major version.'
|
||||
t.users(x)[0]
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ module Inspec::Resources
|
|||
}
|
||||
|
||||
def uid(x)
|
||||
warn '[DEPRECATION] `passwd.uid(arg)` is deprecated. Please use `passwd.uids(arg)` instead. It will be removed in version 1.0.0.'
|
||||
warn '[DEPRECATION] `passwd.uid(arg)` is deprecated. Please use `passwd.uids(arg)` instead. It will be removed in the next major version.'
|
||||
uids(x)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue