Sha256: 424918f21f04f895b2bf7ca4be822cc3ab17ac457b458db4e3ad542d899bc27c

Contents?: true

Size: 746 Bytes

Versions: 1

Compression:

Stored size: 746 Bytes

Contents

#!/usr/bin/env ruby

#onering
#  list      [options] field [key:value ..]
#  search    [options] [key:value .. ]
#  provision [options] [key:value .. ] [pxe profile | ]


require 'rubygems'
require 'json'
require 'subcommander'
require 'onering'

Onering::API::Device.connect

action = ARGV.shift

case (action && action.to_sym)
when :ls, :list
  Onering::API::Device.list(ARGV.shift, (ARGV.empty? ? {} : {
    :filter => ARGV
  }))
when :s, :search
  Onering::API::Device.find(ARGV)

when :save
  data = (STDIN.tty? && ARGV.length > 1 ? File.read(File.expand_path(ARGV.last)) : STDIN.read)

  if data
    data = JSON.load(data)
    Onering::API::Device.save(ARGV.first, data)
  end
else
  STDERR.puts "Usage: onering [subcommand] [options]"
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
onering-client-0.0.4 bin/onering