Adjust deprecations somewhat

Signed-off-by: Clinton Wolfe <clintoncwolfe@gmail.com>
This commit is contained in:
Clinton Wolfe 2019-04-12 10:55:36 -04:00
parent 40031a9b83
commit fc1bc75358
6 changed files with 18 additions and 15 deletions

View file

@ -1,6 +1,6 @@
{ {
"file_version": "1.0.0", "file_version": "1.0.0",
"unknown_group_action": "exit", "unknown_group_action": "ignore",
"groups": { "groups": {
"attrs_value_replaces_default": { "attrs_value_replaces_default": {
"action": "ignore", "action": "ignore",
@ -26,7 +26,8 @@
}, },
"inspec_ui_methods": { "inspec_ui_methods": {
"action": "ignore", "action": "ignore",
"suffix": "Please call `cli.ui` directly" "suffix": "Please call `cli.ui` directly",
"comment": "See #3715"
}, },
"mssql_session_pass_option": { "mssql_session_pass_option": {
"action": "warn", "action": "warn",
@ -84,9 +85,8 @@
"action": "warn", "action": "warn",
"suffix": "This resource will be removed in InSpec 4.0" "suffix": "This resource will be removed in InSpec 4.0"
}, },
"resource_user": { "resource_user_serverspec_compat": {
"action": "warn", "action": "warn"
"suffix": "This resource will be removed in InSpec 4.0."
}, },
"resource_windows_registry_key": { "resource_windows_registry_key": {
"action": "warn", "action": "warn",
@ -100,6 +100,9 @@
"supports_syntax": { "supports_syntax": {
"action": "warn" "action": "warn"
}, },
"mount_parser_serverspec_compat": {
"action": "warn"
},
"wmi_non_hash_usage": { "wmi_non_hash_usage": {
"action": "warn", "action": "warn",
"suffix": "This property will be removed in InSpec 4.0." "suffix": "This property will be removed in InSpec 4.0."

View file

@ -22,7 +22,7 @@ class AwsIamUser < Inspec.resource(1)
alias has_console_password? has_console_password alias has_console_password? has_console_password
def name def name
Inspec.deprecate(:properties_aws_iam_user, 'The aws_iam_users `name` property is deprecated. Please use `username` instead') Inspec.deprecate(:properties_aws_iam_user, 'The aws_iam_user `name` property is deprecated. Please use `username` instead')
username username
end end

View file

@ -49,7 +49,7 @@ module Inspec::Resources
@port = params[:port] @port = params[:port]
if params[:proto] if params[:proto]
Inspec.deprecate(:host_resource_proto_usage, 'The host resource `proto` parameter is deprecated. Please use `protocol`.') Inspec.deprecate(:host_resource_proto_usage, 'The `host` resource `proto` resource parameter is deprecated. Please use `protocol`.')
@protocol = params[:proto] @protocol = params[:proto]
else else
@protocol = params.fetch(:protocol, 'icmp') @protocol = params.fetch(:protocol, 'icmp')

View file

@ -28,7 +28,7 @@ module Inspec::Resources
@user = opts[:user] @user = opts[:user]
@password = opts[:password] || opts[:pass] @password = opts[:password] || opts[:pass]
if opts[:pass] if opts[:pass]
Inspec.deprecate(:oracaldb_session_pass_option, 'The oracledb_session `pass` option is deprecated. Please use `password`.') Inspec.deprecate(:oracledb_session_pass_option, 'The oracledb_session `pass` option is deprecated. Please use `password`.')
end end
@host = opts[:host] || 'localhost' @host = opts[:host] || 'localhost'

View file

@ -213,35 +213,35 @@ module Inspec::Resources
# implement 'mindays' method to be compatible with serverspec # implement 'mindays' method to be compatible with serverspec
def minimum_days_between_password_change def minimum_days_between_password_change
Inspec.deprecate(:resource_user, 'The user resource `minimum_days_between_password_change` property is deprecated. Please use `mindays`.') Inspec.deprecate(:resource_user_serverspec_compat, 'The user resource `minimum_days_between_password_change` property is deprecated. Please use `mindays`.')
mindays mindays
end end
# implement 'maxdays' method to be compatible with serverspec # implement 'maxdays' method to be compatible with serverspec
def maximum_days_between_password_change def maximum_days_between_password_change
Inspec.deprecate(:resource_user, 'The user resource `maximum_days_between_password_change` property is deprecated. Please use `maxdays`.') Inspec.deprecate(:resource_user_serverspec_compat, 'The user resource `maximum_days_between_password_change` property is deprecated. Please use `maxdays`.')
maxdays maxdays
end end
# implements rspec has matcher, to be compatible with serverspec # implements rspec has matcher, to be compatible with serverspec
# @see: https://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers/built_in/has.rb # @see: https://github.com/rspec/rspec-expectations/blob/master/lib/rspec/matchers/built_in/has.rb
def has_uid?(compare_uid) def has_uid?(compare_uid)
Inspec.deprecate(:serverspec_compatibility, 'The user resource `has_uid?` matcher is deprecated.') Inspec.deprecate(:resource_user_serverspec_compat, 'The user resource `has_uid?` matcher is deprecated.')
uid == compare_uid uid == compare_uid
end end
def has_home_directory?(compare_home) def has_home_directory?(compare_home)
Inspec.deprecate(:resource_user, 'The user resource `has_home_directory?` matcher is deprecated. Please use `its(\'home\')`.') Inspec.deprecate(:resource_user_serverspec_compat, 'The user resource `has_home_directory?` matcher is deprecated. Please use `its(\'home\')`.')
home == compare_home home == compare_home
end end
def has_login_shell?(compare_shell) def has_login_shell?(compare_shell)
Inspec.deprecate(:resource_user, 'The user resource `has_login_shell?` matcher is deprecated. Please use `its(\'shell\')`.') Inspec.deprecate(:resource_user_serverspec_compat, 'The user resource `has_login_shell?` matcher is deprecated. Please use `its(\'shell\')`.')
shell == compare_shell shell == compare_shell
end end
def has_authorized_key?(_compare_key) def has_authorized_key?(_compare_key)
Inspec.deprecate(:resource_user, 'The user resource `has_authorized_key?` matcher is deprecated. There is no currently implemented alternative') Inspec.deprecate(:resource_user_serverspec_compat, 'The user resource `has_authorized_key?` matcher is deprecated. There is no currently implemented alternative')
raise NotImplementedError raise NotImplementedError
end end

View file

@ -88,7 +88,7 @@ module LinuxMountParser
# parse options as array # parse options as array
mount_options[:options] = mount[5].gsub(/\(|\)/, '').split(',') mount_options[:options] = mount[5].gsub(/\(|\)/, '').split(',')
else else
Inspec.deprecate(:serverspec_compatibility, 'Parsing mount options in this fashion is deprecated') Inspec.deprecate(:mount_parser_serverspec_compat, 'Parsing mount options in this fashion is deprecated')
mount_options[:options] = {} mount_options[:options] = {}
mount[5].gsub(/\(|\)/, '').split(',').each do |option| mount[5].gsub(/\(|\)/, '').split(',').each do |option|
name, val = option.split('=') name, val = option.split('=')