puppetlabs/puppet · error · ArgumentError

Timespans are only comparable to Timespans, Integers, and Fl

Error message

Timespans are only comparable to Timespans, Integers, and Floats

What it means

Error "Timespans are only comparable to Timespans, Integers, and Floats" thrown in puppetlabs/puppet.

Source

Thrown at lib/puppet/pops/evaluator/compare_operator.rb:105

  end

  def equals_Hash(a, b)
    return false unless b.is_a?(Hash) && a.size == b.size

    a.each { |ak, av| return false unless equals(b[ak], av) }
    true
  end

  def cmp_Symbol(a, b)
    if b.is_a?(Symbol)
      a <=> b
    else
      raise ArgumentError, _("Symbol not comparable to non Symbol")
    end
  end

  def cmp_Timespan(a, b)
    raise ArgumentError, _('Timespans are only comparable to Timespans, Integers, and Floats') unless b.is_a?(Time::Timespan) || b.is_a?(Integer) || b.is_a?(Float)

    a <=> b
  end

  def cmp_Timestamp(a, b)
    raise ArgumentError, _('Timestamps are only comparable to Timestamps, Integers, and Floats') unless b.is_a?(Time::Timestamp) || b.is_a?(Integer) || b.is_a?(Float)

    a <=> b
  end

  def cmp_Version(a, b)
    raise ArgumentError, _('Versions not comparable to non Versions') unless b.is_a?(SemanticPuppet::Version)

    a <=> b
  end

  def cmp_Object(a, b)
    raise ArgumentError, _('Only Strings, Numbers, Timespans, Timestamps, and Versions are comparable')

View on GitHub (pinned to e227c27540)

When it happens

Trigger: Thrown at lib/puppet/pops/evaluator/compare_operator.rb:105 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/3895bb02075daaa1. Report an issue: GitHub.