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

supress warnings #304

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
39 changes: 36 additions & 3 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2408,7 +2408,9 @@ clientId

##### `client_secret`

clientSecret
clientSecret.
Puppet has no way to check current value and will therefore emit a warning
which can be suppressed by setting no_client_secret_warning to true

##### `default_scope`

Expand Down Expand Up @@ -2573,6 +2575,7 @@ The following parameters are available in the `keycloak_identity_provider` type.
* [`alias`](#-keycloak_identity_provider--alias)
* [`internal_id`](#-keycloak_identity_provider--internal_id)
* [`name`](#-keycloak_identity_provider--name)
* [`no_client_secret_warning`](#-keycloak_identity_provider--no_client_secret_warning)
* [`provider`](#-keycloak_identity_provider--provider)
* [`provider_id`](#-keycloak_identity_provider--provider_id)
* [`realm`](#-keycloak_identity_provider--realm)
Expand All @@ -2591,6 +2594,14 @@ namevar

The identity provider name

##### <a name="-keycloak_identity_provider--no_client_secret_warning"></a>`no_client_secret_warning`

Valid values: `true`, `false`, `yes`, `no`

set this to true, to not display the puppet warning that we cannot ensure the client_secret

Default value: `false`

##### <a name="-keycloak_identity_provider--provider"></a>`provider`

The specific backend to use for this `keycloak_identity_provider` resource. You will seldom need to specify this ---
Expand Down Expand Up @@ -2856,7 +2867,9 @@ Default value: `1000`

##### `bind_credential`

bindCredential
bindCredential.
Puppet has no way to check current value and will therefore emit a warning
which can be suppressed by setting no_bind_credential_warning to true

##### `bind_dn`

Expand Down Expand Up @@ -3022,6 +3035,7 @@ The following parameters are available in the `keycloak_ldap_user_provider` type

* [`id`](#-keycloak_ldap_user_provider--id)
* [`name`](#-keycloak_ldap_user_provider--name)
* [`no_bind_credential_warning`](#-keycloak_ldap_user_provider--no_bind_credential_warning)
* [`provider`](#-keycloak_ldap_user_provider--provider)
* [`realm`](#-keycloak_ldap_user_provider--realm)
* [`resource_name`](#-keycloak_ldap_user_provider--resource_name)
Expand All @@ -3036,6 +3050,14 @@ namevar

The LDAP user provider name

##### <a name="-keycloak_ldap_user_provider--no_bind_credential_warning"></a>`no_bind_credential_warning`

Valid values: `true`, `false`, `yes`, `no`

set this to true, to not display the puppet warning that we cannot ensure the smtp_server_password

Default value: `false`

##### <a name="-keycloak_ldap_user_provider--provider"></a>`provider`

The specific backend to use for this `keycloak_ldap_user_provider` resource. You will seldom need to specify this ---
Expand Down Expand Up @@ -3487,7 +3509,9 @@ smtpServer host

##### `smtp_server_password`

smtpServer password
smtpServer password.
Puppet has no way to check current value and will therefore emit a warning
which can be suppressed by setting no_password_warning to true

##### `smtp_server_port`

Expand Down Expand Up @@ -3568,6 +3592,7 @@ The following parameters are available in the `keycloak_realm` type.
* [`id`](#-keycloak_realm--id)
* [`manage_roles`](#-keycloak_realm--manage_roles)
* [`name`](#-keycloak_realm--name)
* [`no_password_warning`](#-keycloak_realm--no_password_warning)
* [`provider`](#-keycloak_realm--provider)

##### <a name="-keycloak_realm--id"></a>`id`
Expand All @@ -3588,6 +3613,14 @@ namevar

The realm name

##### <a name="-keycloak_realm--no_password_warning"></a>`no_password_warning`

Valid values: `true`, `false`, `yes`, `no`

set this to true, to not display the puppet warning that we cannot ensure the smtp_server_password

Default value: `false`

##### <a name="-keycloak_realm--provider"></a>`provider`

The specific backend to use for this `keycloak_realm` resource. You will seldom need to specify this --- Puppet will
Expand Down
14 changes: 12 additions & 2 deletions lib/puppet/type/keycloak_identity_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
require_relative '../../puppet_x/keycloak/array_property'
require_relative '../../puppet_x/keycloak/integer_property'

# needed for puppet >= 8
require 'puppet/parameter/boolean'

Puppet::Type.newtype(:keycloak_identity_provider) do
desc <<-DESC
Manage Keycloak identity providers
Expand Down Expand Up @@ -48,6 +51,11 @@
desc 'realm'
end

newparam(:no_client_secret_warning, boolean: true, parent: Puppet::Parameter::Boolean) do
desc 'set this to true, to not display the puppet warning that we cannot ensure the client_secret'
defaultto :false
end

newproperty(:display_name) do
desc 'displayName'
end
Expand Down Expand Up @@ -149,11 +157,13 @@
end

newproperty(:client_secret) do
desc 'clientSecret'
desc "clientSecret.
Puppet has no way to check current value and will therefore emit a warning
which can be suppressed by setting no_client_secret_warning to true"

def insync?(is)
if is =~ %r{^\*+$}
Puppet.warning("Parameter 'client_secret' is set and Puppet has no way to check current value")
Puppet.warning("Parameter 'client_secret' is set and Puppet has no way to check current value") unless @resource[:no_client_secret_warning]
true
else
false
Expand Down
14 changes: 12 additions & 2 deletions lib/puppet/type/keycloak_ldap_user_provider.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
require_relative '../../puppet_x/keycloak/array_property'
require_relative '../../puppet_x/keycloak/integer_property'

# needed for puppet >= 8
require 'puppet/parameter/boolean'

Puppet::Type.newtype(:keycloak_ldap_user_provider) do
desc <<-DESC
Manage Keycloak LDAP user providers
Expand Down Expand Up @@ -44,6 +47,11 @@
desc 'parentId'
end

newparam(:no_bind_credential_warning, boolean: true, parent: Puppet::Parameter::Boolean) do
desc 'set this to true, to not display the puppet warning that we cannot ensure the smtp_server_password'
defaultto :false
end

newproperty(:enabled, boolean: true) do
desc 'enabled'
newvalues(:true, :false)
Expand Down Expand Up @@ -128,11 +136,13 @@
end

newproperty(:bind_credential) do
desc 'bindCredential'
desc "bindCredential.
Puppet has no way to check current value and will therefore emit a warning
which can be suppressed by setting no_bind_credential_warning to true"

def insync?(is)
if is =~ %r{^\*+$}
Puppet.warning("Parameter 'bind_credential' is set and Puppet has no way to check current value")
Puppet.warning("Parameter 'bind_credential' is set and Puppet has no way to check current value") unless @resource[:no_bind_credential_warning]
true
else
false
Expand Down
14 changes: 12 additions & 2 deletions lib/puppet/type/keycloak_realm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
require_relative '../../puppet_x/keycloak/array_property'
require_relative '../../puppet_x/keycloak/integer_property'

# needed for puppet >= 8
require 'puppet/parameter/boolean'

Puppet::Type.newtype(:keycloak_realm) do
desc <<-DESC
Manage Keycloak realms
Expand Down Expand Up @@ -32,6 +35,11 @@
end
end

newparam(:no_password_warning, boolean: true, parent: Puppet::Parameter::Boolean) do
desc 'set this to true, to not display the puppet warning that we cannot ensure the smtp_server_password'
defaultto :false
end

newproperty(:display_name) do
desc 'displayName'
end
Expand Down Expand Up @@ -274,11 +282,13 @@
end

newproperty(:smtp_server_password) do
desc 'smtpServer password'
desc "smtpServer password.
Puppet has no way to check current value and will therefore emit a warning
which can be suppressed by setting no_password_warning to true"

def insync?(is)
if is =~ %r{^\*+$}
Puppet.warning("Property 'smtp_server_password' is set and Puppet has no way to check current value")
Puppet.warning("Property 'smtp_server_password' is set and Puppet has no way to check current value") unless @resource[:no_password_warning]
true
else
false
Expand Down
1 change: 1 addition & 0 deletions spec/unit/puppet/type/keycloak_identity_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@
describe 'boolean properties' do
# Test boolean properties
[
:no_client_secret_warning,
:enabled,
:trust_email,
:store_token,
Expand Down
1 change: 1 addition & 0 deletions spec/unit/puppet/type/keycloak_ldap_user_provider_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
describe 'boolean properties' do
# Test boolean properties
[
:no_bind_credential_warning,
:enabled,
:import_enabled,
:trust_email,
Expand Down
1 change: 1 addition & 0 deletions spec/unit/puppet/type/keycloak_realm_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
describe 'boolean properties' do
# Test boolean properties
[
:no_password_warning,
:user_managed_access_allowed,
:remember_me,
:registration_allowed,
Expand Down