Project

General

Profile

Bug #2077

Override option checked when a parameter value is a function

Added by Alejandro Falcon over 6 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Puppet
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

OS: Centos 6.3
Puppet version: 2.6.17 from Epel repo
Puppet modules: Example42 modules (https://github.com/example42)
Foreman version: 1.1 RC3 from rpm upgraded from 1.0.1 while keeping existing Mysql DB.

Steps to reproduce:
Import classes from puppet then go to any imported class and go to smart class parameter. All parameters will appear with the override option checked by default.

Note: Classes were imported using the old version first. I've tried importing all classes several times and is having the same issue.

Associated revisions

Revision 4c3b4837 (diff)
Added by Ohad Levy over 6 years ago

fixes #2077 - proxy should not return nil for parameters with a function call

in cases where puppet has class declaration such as:

class xyz($param = myfunction('p'))

the proxy would return a that param value is nil.
this patch changes that, so it return it as a string, allowing users to know
that a function call was there, and allow them to override it if they want.

History

#1 Updated by Ohad Levy over 6 years ago

  • Assignee set to Amos Benari
  • Target version set to 1.1

Amos, do you mind taking a look?

#2 Updated by Ohad Levy over 6 years ago

  • Category set to Puppet integration

OK, digging a bit more into example42 module structure i saw the following

e.g.

class xyz($audit_only = params_lookup( 'audit_only' , 'global' ))

in this case, the value of the parameter depends on an external function (also common when using hiera).

this would lead foreman puppet parser to tell foreman that the audit_only parameter value is empty, in which, in this case, it would assuming its mandatory and required (as if a parameter with no value would fail a puppet catalog compile).

we can probably do two things

  1. remove the code that defines override/required automatically, make it always a user selection
  2. let our proxy code detect its a function, and assume a default value is not required.

What do you think?

#3 Updated by Ohad Levy over 6 years ago

its actually trivial to fix the proxy to detect its a function, e.g. I can easily say detect:

audit_only value is params_lookup("audit_only", "global")

should we just do the same as we do with variable references, and put ${params_lookup...} ? without override / require?

#4 Updated by Ohad Levy over 6 years ago

  • Subject changed from Override option checked by default. to Override option checked when a parameter value is a function

#5 Updated by Ohad Levy over 6 years ago

  • Project changed from Foreman to Smart Proxy
  • Category deleted (Puppet integration)
  • Target version deleted (1.1)

#6 Updated by Ohad Levy over 6 years ago

  • Category set to Puppet
  • Assignee deleted (Amos Benari)
  • Target version set to 1.1

The smart proxy should not report a nil/null value when a parameter is a function.

I suggest we do something similar to how variables are handled, e.g. ${function(param1,param2..paramn)}

#7 Updated by Ohad Levy over 6 years ago

  • Status changed from New to Ready For Testing

possible fix at - https://github.com/theforeman/smart-proxy/pull/51

note, if you already had your class imported, at the moment there is no way to mass un-override them all.

if its a test setup, its best to remove the env (from foreman) and re-import it.

#8 Updated by Ohad Levy over 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF