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

Environment names can't contain only integer #9220

Open
saimonn opened this issue Jan 23, 2024 · 3 comments
Open

Environment names can't contain only integer #9220

saimonn opened this issue Jan 23, 2024 · 3 comments
Labels
accepted Valid issue that we intend to work on when we have the bandwidth bug Something isn't working

Comments

@saimonn
Copy link

saimonn commented Jan 23, 2024

Describe the Bug

Using an environment name composed only of numeric characters makes the catalog compilation fail.
The puppet documentation explains that environment names can contain lowercase letters, numbers and underscores. It does not prohibit the use of numeric characters only.

When using an environment like 42, we get ruby stacktrace like this one:

2024-01-23T11:02:48.938+01:00 ERROR [qtp472974372-11877] [puppetserver] Puppet Server Error: undefined method `match' for 42:Integer
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/node/environment.rb:127:in `valid_name?'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:90:in `uri2indirection'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/indirected_routes.rb:35:in `call'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/api/server/v3.rb:17:in `block in wrap'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:82:in `block in process'
org/jruby/RubyArray.java:1865:in `each'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:81:in `process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:88:in `process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/route.rb:88:in `process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:86:in `block in process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:69:in `block in with_request_profiling'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler/around_profiler.rb:58:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/util/profiler.rb:51:in `profile'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:65:in `with_request_profiling'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:85:in `block in process'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:92:in `respond_to_errors'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/network/http/handler.rb:84:in `process'
uri:classloader:/puppetserver-lib/puppet/server/master.rb:69:in `block in handleRequest'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/context.rb:62:in `override'
/opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet.rb:289:in `override'
uri:classloader:/puppetserver-lib/puppet/server/master.rb:68:in `handleRequest'

Expected Behavior

An environment name composed only of numeric characters should be valid.

Steps to Reproduce

Steps to reproduce the behavior:

  1. Create a puppet environment with only numeric characters (eg.: 42)
  2. run puppet agent -t --environment 42
  3. get the error described above on the puppetserver.

Environment

  • puppetserver Version 7.14.0-1buster
  • Platform Debian buster

Additional Context

We are deploying environments from a Gitlab repository with r10k.
GitLab uses the default pattern %{id}-%{title} when creating a branch from an issue.
If we want keep branch names equals to environment names (i.e. without hyphens), the easy solution is to replace the pattern with %{id} only. Otherwise the spaces and special characters in %{title} xould be converted to hyphens.

Using this workflows, we end up with some numeric only branches/puppet environments.

According to puppet documentation, this shouldn't have been a problem.

A pull-request to fix this in on the way.

@saimonn
Copy link
Author

saimonn commented Apr 11, 2024

workaround: use letters in branch name prefix : eg. using pattern: br%{id}

@AriaXLi AriaXLi added the accepted Valid issue that we intend to work on when we have the bandwidth label Oct 29, 2024
@AriaXLi
Copy link
Contributor

AriaXLi commented Oct 30, 2024

Hi @saimonn, thank you for reporting this issue! The team agrees this is a valid issue, we do not anticipate addressing this any time soon due to other issues demanding precedence. However, this is on the team's radar.

@saimonn
Copy link
Author

saimonn commented Oct 30, 2024

Until this issue is addressed, should we update the documentation to reflect this restriction on environment names ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Valid issue that we intend to work on when we have the bandwidth bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants