lib/blower/context.rb
def once (key, store: "/var/cache/blower.json", quiet: false)
      return yield unless key
      log.info "once: #{key}", quiet: quiet do
        hash_map(hosts) do |host|
          done = begin
            JSON.parse(host.read(store, quiet: true))
          rescue => e
            {}
          end
          unless done[key]
            on [host] do
              yield
            end
            done[key] = true
            host.write(done.to_json, store, quiet: true)
          end
        end
      end
    end
def once (key, store: "/var/cache/blower.json", quiet: false)
      return yield unless key
      log.info "once: #{key}", quiet: quiet do
        hash_map(hosts) do |host|
          done = begin
            JSON.parse(host.read(store, quiet: true))
          rescue => e
            {}
          end
          unless done[key]
            on [host] do
              yield
            end
            done[key] = true
            host.write(done.to_json, store, quiet: true)
          end
        end
      end
    end
Execute a block only once per host.
 It is usually preferable to make tasks idempotent, but when that isn't
 possible, +once+ will only execute the block on hosts where a block
 with the same key hasn't previously been successfully executed.
 @param [String] key Uniquely identifies the block.
 @param [String] store File to store +once+'s state in.
 @macro quietable