Sha256: 055afdb2229b6686cc7fa734f781bb81fa46b828eeffe4f216b05b06a5941ae7

Contents?: true

Size: 832 Bytes

Versions: 2

Compression:

Stored size: 832 Bytes

Contents

## runs facter after deployment

after_activity :__deployment__ do |nodes|
    execute_many "apt-get update -y", :idempotent => true
    execute_many "apt-get install -y facter", :idempotent => true
    facts = execute_many "facter --yaml", :idempotent => true
    # TODO: collect the facts later or something

    data = engine.inline_process(facts) do |fs|
        forall fs do |f|
            yaml = (stdout_of f)
            node = (node_of f)
            value [ node, yaml ]
        end
    end

    facter_facts = { }
    data.each do |node, yaml|
        puts yaml
        facts = YAML.load(yaml)
        facter_facts[node] = facts
    end
    run :"__getset__.set", :facter_facts, facter_facts
end

activity :get_fact do |node, factname|
    facts = run :"__getset__.get", :facter_facts
    facts[node][factname.to_s]
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xpflow-0.1c lib/xpflow/exts/facter.rb
xpflow-0.1b lib/xpflow/exts/facter.rb