File: indirector_proxy.rb

package info (click to toggle)
puppet-agent 8.10.0-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 27,404 kB
  • sloc: ruby: 286,820; sh: 492; xml: 116; makefile: 88; cs: 68
file content (34 lines) | stat: -rw-r--r-- 654 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class Puppet::IndirectorProxy
  class ProxyId
    attr_accessor :name
    def initialize(name)
      self.name = name
    end
  end

  # We should have some way to identify if we got a valid object back with the
  # current values, no?
  attr_accessor :value, :proxyname
  alias_method :name, :value
  alias_method :name=, :value=
  def initialize(value, proxyname)
    self.value = value
    self.proxyname = proxyname
  end

  def self.indirection
    ProxyId.new("file_metadata")
  end

  def self.from_binary(raw)
    new(raw)
  end

  def self.from_data_hash(data)
    new(data['value'])
  end

  def to_data_hash
    { 'value' => value }
  end
end