hammer_cli_import 0.10.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +674 -0
- data/README.md +115 -0
- data/channel_data_pretty.json +10316 -0
- data/config/import/config_macros.yml +16 -0
- data/config/import/interview_answers.yml +13 -0
- data/config/import/role_map.yml +10 -0
- data/config/import.yml +2 -0
- data/lib/hammer_cli_import/activationkey.rb +156 -0
- data/lib/hammer_cli_import/all.rb +253 -0
- data/lib/hammer_cli_import/asynctasksreactor.rb +187 -0
- data/lib/hammer_cli_import/autoload.rb +27 -0
- data/lib/hammer_cli_import/base.rb +585 -0
- data/lib/hammer_cli_import/configfile.rb +392 -0
- data/lib/hammer_cli_import/contenthost.rb +243 -0
- data/lib/hammer_cli_import/contentview.rb +198 -0
- data/lib/hammer_cli_import/csvhelper.rb +68 -0
- data/lib/hammer_cli_import/deltahash.rb +86 -0
- data/lib/hammer_cli_import/fixtime.rb +27 -0
- data/lib/hammer_cli_import/hostcollection.rb +52 -0
- data/lib/hammer_cli_import/import.rb +31 -0
- data/lib/hammer_cli_import/importtools.rb +351 -0
- data/lib/hammer_cli_import/organization.rb +110 -0
- data/lib/hammer_cli_import/persistentmap.rb +225 -0
- data/lib/hammer_cli_import/repository.rb +91 -0
- data/lib/hammer_cli_import/repositoryenable.rb +250 -0
- data/lib/hammer_cli_import/templatesnippet.rb +67 -0
- data/lib/hammer_cli_import/user.rb +155 -0
- data/lib/hammer_cli_import/version.rb +25 -0
- data/lib/hammer_cli_import.rb +53 -0
- metadata +117 -0
data/README.md
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
# hammer-cli-import
|
2
|
+
|
3
|
+
Tool for importing data from an existing Spacewalk/Satellite system.
|
4
|
+
|
5
|
+
THIS TOOL IS WORK IN PROGRESS.
|
6
|
+
|
7
|
+
## Setup info
|
8
|
+
|
9
|
+
To enable modules do the following:
|
10
|
+
|
11
|
+
~~~~ { .bash }
|
12
|
+
mkdir -p ~/.hammer
|
13
|
+
cat >> ~/.hammer/cli_config.yml << EOF
|
14
|
+
:modules:
|
15
|
+
- hammer_cli_import
|
16
|
+
EOF
|
17
|
+
~~~~
|
18
|
+
|
19
|
+
And running with
|
20
|
+
|
21
|
+
~~~ { .bash }
|
22
|
+
env RUBYOPT=-Ilib hammer import
|
23
|
+
~~~
|
24
|
+
|
25
|
+
To build/install as a gem:
|
26
|
+
|
27
|
+
~~~ { .bash }
|
28
|
+
gem build hammer_cli_import.gemspec
|
29
|
+
gem install hammer_cli_import-0.0.1.gem
|
30
|
+
hammer import
|
31
|
+
~~~
|
32
|
+
|
33
|
+
## RuboCop
|
34
|
+
|
35
|
+
[RuboCop][rubocop] requires at least Ruby 1.9.2. That is available in SCL.
|
36
|
+
|
37
|
+
~~~ { .bash }
|
38
|
+
yum install -y ruby193-ruby-devel
|
39
|
+
scl enable ruby193 "gem install rubocop"
|
40
|
+
~~~
|
41
|
+
|
42
|
+
It needs to be run with newer Ruby too (it will pick up its configuration
|
43
|
+
automatically when run from the root of repository).
|
44
|
+
|
45
|
+
~~~ { .bash }
|
46
|
+
scl enable ruby193 "/opt/rh/ruby193/root/usr/local/share/gems/gems/*/bin/rubocop"
|
47
|
+
~~~
|
48
|
+
|
49
|
+
## Development
|
50
|
+
|
51
|
+
You can add to your `~/.irbrc`:
|
52
|
+
|
53
|
+
~~~ { .ruby }
|
54
|
+
class Object
|
55
|
+
def imethods
|
56
|
+
methods - Object.instance_methods
|
57
|
+
end
|
58
|
+
|
59
|
+
def methods_re(re)
|
60
|
+
methods.select do |m|
|
61
|
+
re.match m.to_s
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
~~~
|
66
|
+
|
67
|
+
### Reproducers
|
68
|
+
|
69
|
+
You can play with apipie-bindings on command line. For that you need bundler. Example session:
|
70
|
+
|
71
|
+
~~~
|
72
|
+
[hammer-cli-import]$ gem install bundler
|
73
|
+
[hammer-cli-import]$ bundle exec irb
|
74
|
+
|
75
|
+
require 'apipie-bindings'
|
76
|
+
api = ApipieBindings::API.new({:uri => 'http://localhost/', :username => 'admin', :password => :changeme, :api_version => '2', :aggressive_cache_checking => true})
|
77
|
+
user_hash = {
|
78
|
+
:login => "newuser",
|
79
|
+
:firstname => "user",
|
80
|
+
:lastname => "new",
|
81
|
+
:mail => "root@localhost",
|
82
|
+
:auth_source_id => 1,
|
83
|
+
:password => "password",
|
84
|
+
:organization_ids => [13],
|
85
|
+
:default_organization_id => 13,
|
86
|
+
:location_ids => [],
|
87
|
+
:role_ids => [],
|
88
|
+
}
|
89
|
+
api.resource(:users).call(:create, user_hash)
|
90
|
+
~~~
|
91
|
+
|
92
|
+
or create `reproducer.rb` and then run it via `bundle exec ruby reproducer.rb`.
|
93
|
+
|
94
|
+
~~~ { .ruby }
|
95
|
+
require 'apipie-bindings'
|
96
|
+
|
97
|
+
api = ApipieBindings::API.new({:uri => 'http://localhost/', :username => 'admin',
|
98
|
+
:password => 'changeme', :api_version => '2',
|
99
|
+
:aggressive_cache_checking => true})
|
100
|
+
user_hash = {
|
101
|
+
:login => 'newuser',
|
102
|
+
:firstname => 'user',
|
103
|
+
:lastname => 'new',
|
104
|
+
:mail => 'root@localhost',
|
105
|
+
:auth_source_id => 1,
|
106
|
+
:password => 'password',
|
107
|
+
:organization_ids => [13],
|
108
|
+
:default_organization_id => 13,
|
109
|
+
:location_ids => [],
|
110
|
+
:role_ids => []
|
111
|
+
}
|
112
|
+
api.resource(:users).call(:create, user_hash)
|
113
|
+
~~~
|
114
|
+
|
115
|
+
[rubocop]: http://batsov.com/rubocop/ "Ruby code analyzer"
|