Git Product home page Git Product logo

hammer-cli-import's Introduction

hammer-cli-import

Tool for importing data from an existing Spacewalk/Satellite system.

THIS TOOL IS WORK IN PROGRESS.

Setup info

To enable modules do the following:

mkdir -p ~/.hammer
cat >> ~/.hammer/cli_config.yml << EOF
:modules:
  - hammer_cli_import
EOF

And running with

# env RUBYOPT=-Ilib hammer import

To build/install as a gem:

# gem build hammer_cli_import.gemspec
# gem install hammer_cli_import-0.0.1.gem
# hammer import

RuboCop

RuboCop requires at least Ruby 1.9.2. That is available in SCL.

# yum install -y ruby193-ruby-devel
# scl enable ruby193 "gem install rubocop"

It needs to be run with newer Ruby too (it will pick up its configuration automatically when run from the root of repository).

# scl enable ruby193 "/opt/rh/ruby193/root/usr/local/share/gems/gems/*/bin/rubocop"

Development

You can add to your ~/.irbrc:

class Object
  def imethods
    methods - Object.instance_methods
  end

  def methods_re(re)
    methods.select do |m|
      re.match m.to_s
    end
  end
end

Reproducers

You can play with apipie-bindings on command line. For that you need bundler. Example session:

[hammer-cli-import]$ gem install bundler
[hammer-cli-import]$ bundle exec irb

require 'apipie-bindings'
api = ApipieBindings::API.new({:uri => 'http://localhost/', :username => 'admin', :password => :changeme, :api_version => '2', :aggressive_cache_checking => true})
user_hash = {
:login => "newuser",
:firstname => "user",
:lastname => "new",
:mail => "root@localhost",
:auth_source_id => 1,
:password => "password",
:organization_ids => [13],
:default_organization_id => 13,
:location_ids => [],
:role_ids => [],
}
api.resource(:users).call(:create, user_hash)

or create reproducer.rb and then run it via bundle exec ruby reproducer.rb.

require 'apipie-bindings'

api = ApipieBindings::API.new({:uri => 'http://localhost/', :username => 'admin',
                               :password => 'changeme', :api_version => '2',
                               :aggressive_cache_checking => true})
user_hash = {
  :login => 'newuser',
  :firstname => 'user',
  :lastname => 'new',
  :mail => 'root@localhost',
  :auth_source_id => 1,
  :password => 'password',
  :organization_ids => [13],
  :default_organization_id => 13,
  :location_ids => [],
  :role_ids => []
}
api.resource(:users).call(:create, user_hash)

hammer-cli-import's People

Contributors

xkollar avatar tlestach avatar ggainey avatar lpramuk avatar jmontleon avatar jlsherrill avatar zleite avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.