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

Fix title patterns that use procs are not supported #21

Merged
merged 1 commit into from
Mar 10, 2018

Conversation

alexjfisher
Copy link
Contributor

This commit makes the module compatible with puppet generate types.
Environment isolation is really important for a module where types
are having new parameters added on a regular basis.

See
https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
puppetlabs/puppetlabs-java_ks#169
voxpupuli/puppet-wildfly#227

This commit makes the module compatible with `puppet generate types`.
Environment isolation is *really* important for a module where types
are having new parameters added on a regular basis.

See
https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
puppetlabs/puppetlabs-java_ks#169
voxpupuli/puppet-wildfly#227
@alexjfisher
Copy link
Contributor Author

I've tested this and here is a sample of one of the .resource_types files puppet generate types can now create.

cat .resource_types/keycloak_client.pp
# This file was automatically generated on 2018-03-09 10:13:05 +0000.
# Use the 'puppet generate types' command to regenerate this file.

Puppet::Resource::ResourceType3.new(
  'keycloak_client',
  [
    # The basic property that the resource should be in.
    #
    # Valid values are `present`, `absent`.
    Puppet::Resource::Param(Enum['present', 'absent'], 'ensure'),

    # protocol
    #
    # Valid values are `openid-connect`, `saml`.
    Puppet::Resource::Param(Enum['openid-connect', 'saml'], 'protocol'),

    # clientAuthenticatorType
    Puppet::Resource::Param(Any, 'client_authenticator_type'),

    # clientTemplate
    Puppet::Resource::Param(Any, 'client_template'),

    # enabled
    #
    # Valid values are `true`, `false`.
    Puppet::Resource::Param(Variant[Boolean, Enum['true', 'false']], 'enabled'),

    # directAccessGrantsEnabled
    #
    # Valid values are `true`, `false`.
    Puppet::Resource::Param(Variant[Boolean, Enum['true', 'false']], 'direct_access_grants_enabled'),

    # publicClient
    #
    # Valid values are `true`, `false`.
    Puppet::Resource::Param(Variant[Boolean, Enum['true', 'false']], 'public_client'),

    # redirectUris
    Puppet::Resource::Param(Any, 'redirect_uris'),

    # webOrigins
    Puppet::Resource::Param(Any, 'web_origins')
  ],
  [
    # The client name
    Puppet::Resource::Param(Any, 'name', true),

    # clientId
    Puppet::Resource::Param(Any, 'client_id', true),

    # Id
    Puppet::Resource::Param(Any, 'id'),

    # realm
    Puppet::Resource::Param(Any, 'realm', true),

    # secret
    Puppet::Resource::Param(Any, 'secret'),

    # The specific backend to use for this `keycloak_client`
    # resource. You will seldom need to specify this --- Puppet will usually
    # discover the appropriate provider for your platform.Available providers are:
    #
    # kcadm
    # :
    Puppet::Resource::Param(Any, 'provider')
  ],
  {
    /^((\S+) on (\S+))$/ => ['name', 'client_id', 'realm'],
    /(.*)/ => ['name']
  },
  true,
  false)

@treydock
Copy link
Owner

@alexjfisher Thanks for the contribution. I was not aware of the environment isolation features but should solve several problems I've had with type properties changing and causing issues until puppetserver restarted. Now the task of updating other's modules with this similar change.

@treydock treydock merged commit 4ce4bf3 into treydock:master Mar 10, 2018
treydock added a commit to treydock/puppet-openldap that referenced this pull request Mar 11, 2018
Currently the title patterns with proc prevent `puppet generate types` from working:

Error: /etc/puppetlabs/code/environments/production/modules/openldap/lib/puppet/type/openldap_access.rb: title patterns that use procs are not supported.
Error: /etc/puppetlabs/code/environments/production/modules/openldap/lib/puppet/type/openldap_dbindex.rb: title patterns that use procs are not supported.
Error: /etc/puppetlabs/code/environments/production/modules/openldap/lib/puppet/type/openldap_overlay.rb: title patterns that use procs are not supported.

https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
treydock/puppet-module-keycloak#21
treydock added a commit to treydock/puppet-splunk that referenced this pull request Mar 11, 2018
This will allow `puppet generate types` to function

Example:
Error: /etc/puppetlabs/code/environments/production/modules/splunk/lib/puppet/type/splunk_alert_actions.rb: title patterns that use procs are not supported.

https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
treydock/puppet-module-keycloak#21
treydock added a commit to treydock/augeasproviders_shellvar that referenced this pull request Mar 11, 2018
This will resolve errors with `puppet generate types`

Example:
```
Error: /etc/puppetlabs/code/environments/production/modules/augeasproviders_shellvar/lib/puppet/type/shellvar.rb: title patterns that use procs are not supported.
```

https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
treydock/puppet-module-keycloak#21
treydock added a commit to treydock/puppet-windows_env that referenced this pull request Mar 11, 2018
This change will allow `puppet generate types` to function

Error:
```
Error: /etc/puppetlabs/code/environments/production/modules/windows_env/lib/puppet/type/windows_env.rb: title patterns that use procs are not supported.
```

https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
treydock/puppet-module-keycloak#21
treydock added a commit to treydock/puppet-windows_env that referenced this pull request Mar 11, 2018
This change will allow `puppet generate types` to function

Error:
```
Error: /etc/puppetlabs/code/environments/production/modules/windows_env/lib/puppet/type/windows_env.rb: title patterns that use procs are not supported.
```

https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
treydock/puppet-module-keycloak#21
treydock added a commit to treydock/puppet-windows_env that referenced this pull request Mar 11, 2018
This change will allow `puppet generate types` to function

Error:
```
Error: /etc/puppetlabs/code/environments/production/modules/windows_env/lib/puppet/type/windows_env.rb: title patterns that use procs are not supported.
```

https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
treydock/puppet-module-keycloak#21
@alexjfisher
Copy link
Contributor Author

In some cases even restarting the puppetserver wasn't enough. If not all environments have the same version of the module, it's luck of the draw as to which version gets loaded first.

puppet generate types fixes isolation of native types only. Functions have to be converted to use the Puppet 4 API (not an issue in this module).

trevor-vaughan pushed a commit to voxpupuli/puppet-augeasproviders_shellvar that referenced this pull request Apr 14, 2018
* Fix title patterns to not use unsupported proc

This will resolve errors with `puppet generate types`

Example:
```
Error: /etc/puppetlabs/code/environments/production/modules/augeasproviders_shellvar/lib/puppet/type/shellvar.rb: title patterns that use procs are not supported.
```

https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
treydock/puppet-module-keycloak#21

Closes #27
Closes #26
treydock added a commit to treydock/puppet-splunk that referenced this pull request Oct 29, 2018
This will allow `puppet generate types` to function

Example:
Error: /etc/puppetlabs/code/environments/production/modules/splunk/lib/puppet/type/splunk_alert_actions.rb: title patterns that use procs are not supported.

https://tickets.puppetlabs.com/browse/MODULES-4505?focusedCommentId=418416&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-418416
treydock/puppet-module-keycloak#21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants