Module: Puppet::Pops::Issues
- Defined in:
- lib/puppet/pops/issues.rb
Overview
Defines classes to deal with issues, and message formatting and defines constants with Issues.
Defined Under Namespace
Classes: Issue, MessageData
Constant Summary collapse
- NAME_WITH_HYPHEN =
TODO:
configuration
This is allowed (3.1) and has not yet been deprecated.
issue :NAME_WITH_HYPHEN, :name do "#{label.a_an_uc(semantic)} may not have a name containing a hyphen. The name '#{name}' is not legal" end
- VAR_WITH_HYPHEN =
TODO:
describe the setting
TODO:configuration if this is error or warning
When a variable name contains a hyphen and these are illegal. It is possible to control if a hyphen is legal in a name or not using the setting TODO
issue :VAR_WITH_HYPHEN, :name do "A variable name may not contain a hyphen. The name '#{name}' is not legal" end
- NOT_TOP_LEVEL =
TODO:
Is this really true for nodes? Can they be inside classes? Isn’t that too late?
A class, definition, or node may only appear at top level or inside other classes
hard_issue :NOT_TOP_LEVEL do "Classes, definitions, and nodes may only appear at toplevel or inside other classes" end
- CROSS_SCOPE_ASSIGNMENT =
hard_issue :CROSS_SCOPE_ASSIGNMENT, :name do "Illegal attempt to assign to '#{name}'. Cannot assign to variables in other namespaces" end
- ILLEGAL_ASSIGNMENT =
Assignment can only be made to certain types of left hand expressions such as variables.
hard_issue :ILLEGAL_ASSIGNMENT do "Illegal attempt to assign to '#{label.a_an(semantic)}'. Not an assignable reference" end
- ILLEGAL_NUMERIC_ASSIGNMENT =
Assignment cannot be made to numeric match result variables
issue :ILLEGAL_NUMERIC_ASSIGNMENT, :varname do "Illegal attempt to assign to the numeric match result variable '$#{varname}'. Numeric variables are not assignable" end
- ILLEGAL_NUMERIC_PARAMETER =
parameters cannot have numeric names, clashes with match result variables
issue :ILLEGAL_NUMERIC_PARAMETER, :name do "The numeric parameter name '$#{varname}' cannot be used (clashes with numeric match result variables)" end
- ILLEGAL_INDEXED_ASSIGNMENT =
In certain versions of Puppet it may be allowed to assign to a not already assigned key in an array or a hash. This is an optional validation that may be turned on to prevent accidental mutation.
issue :ILLEGAL_INDEXED_ASSIGNMENT do "Illegal attempt to assign via [index/key]. Not an assignable reference" end
- ILLEGAL_ASSIGNMENT_VIA_INDEX =
When indexed assignment ($x[]=) is allowed, the leftmost expression must be a variable expression.
hard_issue :ILLEGAL_ASSIGNMENT_VIA_INDEX do "Illegal attempt to assign to #{label.a_an(semantic)} via [index/key]. Not an assignable reference" end
- NOT_RVALUE =
Some expressions/statements may not produce a value (known as right-value, or rvalue). This may vary between puppet versions.
issue :NOT_RVALUE do "Invalid use of expression. #{label.a_an_uc(semantic)} does not produce a value" end
- ILLEGAL_ATTRIBUTE_APPEND =
Appending to attributes is only allowed in certain types of resource expressions.
hard_issue :ILLEGAL_ATTRIBUTE_APPEND, :name, :parent do "Illegal +> operation on attribute #{name}. This operator can not be used in #{label.a_an(parent)}" end
- ILLEGAL_NAME =
hard_issue :ILLEGAL_NAME, :name do "Illegal name. The given name #{name} does not conform to the naming rule \\A((::)?[a-z0-9]\w*)(::[a-z0-9]\w*)*\\z" end
- ILLEGAL_CLASSREF =
In case a model is constructed programmatically, it must create valid type references.
hard_issue :ILLEGAL_CLASSREF, :name do "Illegal type reference. The given name '#{name}' does not conform to the naming rule" end
- RT_NO_STORECONFIGS =
TODO:
should be a :warning by default
This is a runtime issue - storeconfigs must be on in order to collect exported. This issue should be set to :ignore when just checking syntax.
issue :RT_NO_STORECONFIGS do "You cannot collect exported resources without storeconfigs being set; the collection will be ignored" end
- RT_NO_STORECONFIGS_EXPORT =
TODO:
should be a :warning by default
This is a runtime issue - storeconfigs must be on in order to export a resource. This issue should be set to :ignore when just checking syntax.
issue :RT_NO_STORECONFIGS_EXPORT do "You cannot collect exported resources without storeconfigs being set; the export is ignored" end
- ILLEGAL_HOSTNAME_CHARS =
A hostname may only contain letters, digits, ‘_’, ‘-’, and ‘.’.
hard_issue :ILLEGAL_HOSTNAME_CHARS, :hostname do "The hostname '#{hostname}' contains illegal characters (only letters, digits, '_', '-', and '.' are allowed)" end
- ILLEGAL_HOSTNAME_INTERPOLATION =
A hostname may only contain letters, digits, ‘_’, ‘-’, and ‘.’.
hard_issue :ILLEGAL_HOSTNAME_INTERPOLATION do "An interpolated expression is not allowed in a hostname of a node" end
- ILLEGAL_EXPRESSION =
Issues when an expression is used where it is not legal. E.g. an arithmetic expression where a hostname is expected.
hard_issue :ILLEGAL_EXPRESSION, :feature, :container do "Illegal expression. #{label.a_an_uc(semantic)} is unacceptable as #{feature} in #{label.a_an(container)}" end
- ILLEGAL_QUERY_EXPRESSION =
Issues when an expression is used illegaly in a query. query only supports == and !=, and not <, > etc.
hard_issue :ILLEGAL_QUERY_EXPRESSION do "Illegal query expression. #{label.a_an_uc(semantic)} cannot be used in a query" end
- NOT_VIRTUALIZEABLE =
If an attempt is made to make a resource default virtual or exported.
hard_issue :NOT_VIRTUALIZEABLE do "Resource Defaults are not virtualizable" end
- UNSUPPORTED_RANGE =
When an attempt is made to use multiple keys (to produce a range in Ruby - e.g. $arr). This is currently not supported, but may be in future versions
issue :UNSUPPORTED_RANGE, :count do "Attempt to use unsupported range in #{label.a_an(semantic)}, #{count} values given for max 1" end
- DEPRECATED_NAME_AS_TYPE =
issue :DEPRECATED_NAME_AS_TYPE, :name do "Resource references should now be capitalized. The given '#{name}' does not have the correct form" end
Class Method Summary collapse
-
.hard_issue(issue_code, *args, &block) ⇒ Object
Creates a non demotable issue.
-
.issue(issue_code, *args, &block) ⇒ Object
Defines an issue with the given
issue_code, additional required parameters, and a block producing a message.
Class Method Details
.hard_issue(issue_code, *args, &block) ⇒ Object
Creates a non demotable issue.
112 113 114 115 116 |
# File 'lib/puppet/pops/issues.rb', line 112 def self.hard_issue(issue_code, *args, &block) result = Issue.new(issue_code, *args, &block) result.demotable = false result end |
.issue(issue_code, *args, &block) ⇒ Object
Defines an issue with the given issue_code, additional required parameters, and a block producing a message. The block is evaluated in the context of a MessageData which provides convenient access to all required arguments via accessor methods. In addition to accessors for specified arguments, these are also available:
-
label- aLabelProviderthat provides human understandable names for model elements and production of article (a/an/the). -
semantic- the model element for which the issue is reported
105 106 107 |
# File 'lib/puppet/pops/issues.rb', line 105 def self.issue (issue_code, *args, &block) Issue.new(issue_code, *args, &block) end |