Jira (PUP-8745) The match function does not accept a type alias

3 views
Skip to first unread message

Nick Walker (JIRA)

unread,
May 16, 2018, 3:43:03 PM5/16/18
to puppe...@googlegroups.com
Nick Walker created an issue
 
Puppet / Bug PUP-8745
The match function does not accept a type alias
Issue Type: Bug Bug
Assignee: Unassigned
Created: 2018/05/16 12:42 PM
Priority: Normal Normal
Reporter: Nick Walker

The Problem

Passing a type alias to the match function results in an error.

Example Code:

https://github.com/npwalker/regex_variable/blob/test_pattern_type_alias/manifests/profile/test.pp#L14

And example error:

error during compilation: Evaluation Error: Error while evaluating a Method call, match() expects pattern of T, where T is String, Regexp, Regexp[r], Pattern[p], or Array[T]. Got Puppet::Pops::Types::PTypeAliasType (file: /home/travis/build/npwalker/regex_variable/spec/fixtures/modules/regex_variable/manifests/profile/test.pp, line: 14, column: 21) on node travis-job-npwalker-regex-variable-124411915.travisci.net

Which can been seen in travis as well:

https://travis-ci.com/npwalker/regex_variable/jobs/124411915#L532

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.7.1#77002-sha1:e75ca93)
Atlassian logo

Henrik Lindberg (JIRA)

unread,
May 17, 2018, 4:07:03 AM5/17/18
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
May 17, 2018, 4:07:03 AM5/17/18
to puppe...@googlegroups.com

Henrik Lindberg (JIRA)

unread,
May 17, 2018, 4:17:03 AM5/17/18
to puppe...@googlegroups.com
Henrik Lindberg commented on Bug PUP-8745
 
Re: The match function does not accept a type alias

Marked this as "major" because there is no work around when you need the match function (expect to patch puppet)

Henrik Lindberg (JIRA)

unread,
May 18, 2018, 2:30:04 AM5/18/18
to puppe...@googlegroups.com

A possible work around for this is to make a copy of the match function and modify it to be in a module namespace of your own (mymodule::match()). Then deprecate that function and change to use the puppet match() when you have 5.5.2.

The other way to work around this is to call a function in the type declaration and have that return the regular expression that in Nick's use case is the regexp that is "shared". That will stop working as it relies on a bug that allows this construct - it will be blocked in Puppet 6.0.0 - hence this is not the best work around.

John Duarte (JIRA)

unread,
Oct 21, 2019, 10:48:06 AM10/21/19
to puppe...@googlegroups.com
John Duarte updated an issue
 
Change By: John Duarte
QA Risk Assessment: Needs Assessment No Action

Austin Boyd (JIRA)

unread,
Dec 12, 2019, 8:38:04 AM12/12/19
to puppe...@googlegroups.com
Austin Boyd updated an issue
Change By: Austin Boyd
Zendesk Ticket IDs: 33510
Zendesk Ticket Count: 1
Reply all
Reply to author
Forward
0 new messages