Class: Puppet::Pops::Validation::TasksChecker Private

Inherits:
Checker4_0 show all
Defined in:
lib/puppet/pops/validation/tasks_checker.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Validator that limits the set of allowed expressions to not include catalog related operations

Constant Summary

Constants inherited from Checker4_0

Checker4_0::BAD_MODULE_FILE, Checker4_0::FUTURE_RESERVED_WORDS, Checker4_0::NO_NAMESPACE, Checker4_0::NO_PATH, Checker4_0::RESERVED_PARAMETERS, Checker4_0::RESERVED_TYPE_NAMES

Constants inherited from Evaluator::LiteralEvaluator

Evaluator::LiteralEvaluator::COMMA_SEPARATOR

Instance Attribute Summary

Attributes inherited from Checker4_0

#acceptor, #migration_checker

Instance Method Summary collapse

Methods inherited from Checker4_0

#assign, #assign_AccessExpression, #assign_LiteralList, #assign_Object, #assign_VariableExpression, #check, #check_AccessExpression, #check_AssignmentExpression, #check_AttributeOperation, #check_AttributesOperation, #check_BinaryExpression, #check_BlockExpression, #check_CallNamedFunctionExpression, #check_CaseExpression, #check_CaseOption, #check_EppExpression, #check_Factory, #check_FunctionDefinition, #check_HeredocExpression, #check_IfExpression, #check_KeyedEntry, #check_LambdaExpression, #check_LiteralHash, #check_LiteralInteger, #check_LiteralList, #check_MethodCallExpression, #check_NamedAccessExpression, #check_NamedDefinition, #check_Object, #check_Parameter, #check_QualifiedName, #check_QualifiedReference, #check_QueryExpression, #check_ReservedWord, #check_ResourceBody, #check_SelectorEntry, #check_SelectorExpression, #check_TypeAlias, #check_TypeDefinition, #check_TypeMapping, #check_UnaryExpression, #check_UnlessExpression, #check_VariableExpression, check_visitor, #container, #dir_to_names, #ends_with_idem, #hostname, #hostname_Array, #hostname_ConcatenatedString, #hostname_LiteralDefault, #hostname_LiteralNumber, #hostname_LiteralRegularExpression, #hostname_LiteralValue, #hostname_Object, #hostname_QualifiedName, #hostname_QualifiedReference, #hostname_String, #idem, #idem_AccessExpression, #idem_ApplyExpression, #idem_AssignmentExpression, #idem_BinaryExpression, #idem_BlockExpression, #idem_CaseExpression, #idem_CaseOption, #idem_ConcatenatedString, #idem_Factory, #idem_HeredocExpression, #idem_IfExpression, #idem_Literal, #idem_LiteralHash, #idem_LiteralList, #idem_MatchExpression, #idem_NilClass, #idem_Nop, #idem_Object, #idem_ParenthesizedExpression, #idem_RelationshipExpression, #idem_RenderExpression, #idem_RenderStringExpression, #idem_SelectorExpression, #idem_UnaryExpression, #initial_manifest?, #initialize, #internal_check_capture_last, #internal_check_file_namespace, #internal_check_future_reserved_word, #internal_check_illegal_assignment, #internal_check_no_capture, #internal_check_no_idem_last, #internal_check_parameter_name_uniqueness, #internal_check_reserved_params, #internal_check_reserved_type_name, #internal_check_return_type, #internal_check_top_construct_in_module, #internal_check_type_ref, #namespace_for_file, #pattern_with_replacement?, #query, #query_BooleanExpression, #query_ComparisonExpression, #query_LiteralBoolean, #query_LiteralNumber, #query_LiteralString, #query_Object, #query_ParenthesizedExpression, #query_QualifiedName, #query_VariableExpression, #relation, #relation_CollectExpression, #relation_Object, #relation_RelationshipExpression, #rvalue, #rvalue_CollectExpression, #rvalue_Definition, #rvalue_Expression, #rvalue_NodeDefinition, #rvalue_UnaryExpression, #top, #type_ref?, #valid_top_construct?, #validate, #varname_to_s

Methods included from Evaluator::ExternalSyntaxSupport

#assert_external_syntax, #checker_for_syntax, #lookup_keys_for_syntax

Methods inherited from Evaluator::LiteralEvaluator

#initialize, #literal, #literal_ConcatenatedString, #literal_Factory, #literal_LiteralBoolean, #literal_LiteralDefault, #literal_LiteralHash, #literal_LiteralList, #literal_LiteralNumber, #literal_LiteralRegularExpression, #literal_LiteralString, #literal_LiteralUndef, #literal_Object, #literal_Program, #literal_QualifiedName

Constructor Details

This class inherits a constructor from Puppet::Pops::Validation::Checker4_0

Instance Method Details

#check_ApplyExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



79
80
81
82
83
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 79

def check_ApplyExpression(o)
  if in_ApplyExpression?
    acceptor.accept(Issues::EXPRESSION_NOT_SUPPORTED_WHEN_COMPILING, o, {:klass => o})
  end
end

#check_CollectExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 17

def check_CollectExpression(o)
  # Only virtual resource queries are allowed in apply blocks, not exported
  # resource queries
  if in_ApplyExpression?
    if o.query.is_a?(Puppet::Pops::Model::VirtualQuery)
      super(o)
    else
      acceptor.accept(Issues::EXPRESSION_NOT_SUPPORTED_WHEN_COMPILING, o, {:klass => o})
    end
  else
    illegalTasksExpression(o)
  end
end

#check_HostClassDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 31

def check_HostClassDefinition(o)
  illegalTasksExpression(o)
end

#check_NodeDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



35
36
37
38
39
40
41
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 35

def check_NodeDefinition(o)
  if in_ApplyExpression?
    super(o)
  else
    illegalTasksExpression(o)
  end
end

#check_RelationshipExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



43
44
45
46
47
48
49
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 43

def check_RelationshipExpression(o)
  if in_ApplyExpression?
    super(o)
  else
    illegalTasksExpression(o)
  end
end

#check_ResourceDefaultsExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



51
52
53
54
55
56
57
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 51

def check_ResourceDefaultsExpression(o)
  if in_ApplyExpression?
    super(o)
  else
    illegalTasksExpression(o)
  end
end

#check_ResourceExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



59
60
61
62
63
64
65
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 59

def check_ResourceExpression(o)
  if in_ApplyExpression?
    super(o)
  else
    illegalTasksExpression(o)
  end
end

#check_ResourceOverrideExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



67
68
69
70
71
72
73
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 67

def check_ResourceOverrideExpression(o)
  if in_ApplyExpression?
    super(o)
  else
    illegalTasksExpression(o)
  end
end

#check_ResourceTypeDefinition(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



75
76
77
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 75

def check_ResourceTypeDefinition(o)
  illegalTasksExpression(o)
end

#illegalTasksExpression(o) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



85
86
87
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 85

def illegalTasksExpression(o)
  acceptor.accept(Issues::EXPRESSION_NOT_SUPPORTED_WHEN_SCRIPTING, o, {:klass => o})
end

#in_ApplyExpression?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


8
9
10
11
12
13
14
15
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 8

def in_ApplyExpression?
  top = container(0)
  step = -1
  until container(step) == top do
    return true if container(step).is_a? Puppet::Pops::Model::ApplyBlockExpression
    step -= 1
  end
end

#resource_without_title?(o) ⇒ Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Boolean)


89
90
91
# File 'lib/puppet/pops/validation/tasks_checker.rb', line 89

def resource_without_title?(o)
  false
end