Sha256: 385f1f5d36ff067491228b7a669e70fec893ca77ea959d335f69badd623a3080

Contents?: true

Size: 713 Bytes

Versions: 12

Compression:

Stored size: 713 Bytes

Contents

# frozen_string_literal: true

class Puppet::Settings::AliasSetting
  attr_reader :name, :alias_name

  def initialize(args = {})
    @name = args[:name]
    @alias_name = args[:alias_for]
    @alias_for = Puppet.settings.setting(alias_name)
  end

  def optparse_args
    args = @alias_for.optparse_args
    args[0].gsub!(alias_name.to_s, name.to_s)
    args
  end

  def getopt_args
    args = @alias_for.getopt_args
    args[0].gsub!(alias_name.to_s, name.to_s)
    args
  end

  def type
    :alias
  end

  def method_missing(method, *args)
    begin
      alias_for.send(method, *args)
    rescue => e
      Puppet.log_exception(self.class, e.message)
    end
  end

  private

  attr_reader :alias_for
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
puppet-8.5.1 lib/puppet/settings/alias_setting.rb
puppet-8.5.1-x86-mingw32 lib/puppet/settings/alias_setting.rb
puppet-8.5.1-x64-mingw32 lib/puppet/settings/alias_setting.rb
puppet-8.5.1-universal-darwin lib/puppet/settings/alias_setting.rb
puppet-8.5.0 lib/puppet/settings/alias_setting.rb
puppet-8.5.0-x86-mingw32 lib/puppet/settings/alias_setting.rb
puppet-8.5.0-x64-mingw32 lib/puppet/settings/alias_setting.rb
puppet-8.5.0-universal-darwin lib/puppet/settings/alias_setting.rb
puppet-8.4.0 lib/puppet/settings/alias_setting.rb
puppet-8.4.0-x86-mingw32 lib/puppet/settings/alias_setting.rb
puppet-8.4.0-x64-mingw32 lib/puppet/settings/alias_setting.rb
puppet-8.4.0-universal-darwin lib/puppet/settings/alias_setting.rb