HEX
Server: Apache
System: Linux dinesh8189 5.15.98-grsec-sharedvalley-2.lc.el8.x86_64 #1 SMP Thu Mar 9 09:07:30 -03 2023 x86_64
User: cgmgerenciamento1 (814285)
PHP: 8.1.26
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: //opt/puppetlabs/puppet/lib/ruby/vendor_ruby/puppet/pops/validation/tasks_checker.rb
module Puppet::Pops
module Validation

# Validator that limits the set of allowed expressions to not include catalog related operations
# @api private
class TasksChecker < Checker4_0
  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

  def check_Application(o)
    illegalTasksExpression(o)
  end

  def check_CapabilityMapping(o)
    illegalTasksExpression(o)
  end

  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

  def check_HostClassDefinition(o)
    illegalTasksExpression(o)
  end

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

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

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

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

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

  def check_ResourceTypeDefinition(o)
    illegalTasksExpression(o)
  end

  def check_SiteDefinition(o)
    illegalTasksExpression(o)
  end

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

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

  def resource_without_title?(o)
    false
  end
end
end
end