Class: Itamae::Plugin::Resource::Alternatives

Inherits:
Resource::Base
  • Object
show all
Defined in:
lib/itamae/plugin/resource/alternatives.rb

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Instance Method Details

#action_create(options) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/itamae/plugin/resource/alternatives.rb', line 23

def action_create(options)
  if attributes.auto
    if !current.auto
      run_command(["update-alternatives", "--auto", attributes.name])
    end
  else
    if current.auto || attributes.path != current.path
      run_command([
                    "update-alternatives", "--set", attributes.name,
                    attributes.path,
                  ])
    end
  end
end

#set_current_attributesObject



18
19
20
21
# File 'lib/itamae/plugin/resource/alternatives.rb', line 18

def set_current_attributes
  q = run_command(["update-alternatives", "--query", attributes.name])
  parse_query(q)
end