Skip to content

missing validation of attribute names containing upper case characters #243

Open
@DavidS

Description

@DavidS

Describe the Bug

register_type accepts attribute names containing upper case characters. Puppet will happily downcase those for internal processing, without RSAPI noticing. this in turn leads to random-looking failures later in processing.

Expected Behavior

RSAPI register_type and register_transport refuse to accept attribute/connection_info keys that do not conform to all-lower-case snake casing rules (all lowercase, numbers, underscores, starts with letter).

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a new type called some with a mandatory attribute called someThing
  2. Run puppet apply -e 'some { foo: }

Will fail with:

david@davids:~/tmp/foo$ pdk bundle exec puppet apply -e 'some { test: }' --verbose --trace --modulepath spec/fixtures/modules
pdk (INFO): Using Ruby 2.5.7
pdk (INFO): Using Puppet 6.10.1
Notice: Compiled catalog for localhost in environment production in 0.11 seconds
Info: Applying configuration version '1573033174'
Error: /Stage[main]/Some[test]: Could not evaluate: The following mandatory attributes were not provided:
    *  SomeThing
/opt/puppetlabs/pdk/private/puppet/ruby/2.5.0/gems/puppet-resource_api-1.8.7/lib/puppet/resource_api.rb:342:in `raise_missing_attrs'
/opt/puppetlabs/pdk/private/puppet/ruby/2.5.0/gems/puppet-resource_api-1.8.7/lib/puppet/resource_api.rb:289:in `retrieve'
/opt/puppetlabs/pdk/share/cache/ruby/2.5.0/gems/puppet-6.10.1/lib/puppet/type.rb:1133:in `retrieve_resource'
[...]

Additional Context

This problem was originally reported and diagnosed by Brian Dinga on the community slack.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions