Project

General

Profile

Revision 9439ade5

Added by Thomas McKay almost 9 years ago

removed hammer-it

adding config

cleaning it up

cleaning up tests

updated case statement

View differences:

.gitignore
20 20
pickle-email-*.html
21 21
.project
22 22
config/initializers/secret_token.rb
23
config/cli_config.yml
24
config/cli.modules.d/csv.yml
25
config/cli.modules.d/foreman.yml
26
config/cli.modules.d/katello.yml
23 27
test/data/*.zip
24 28
test/config.yml
25 29
.ruby-version
26
.idea
30
.idea
31
Gemfile.local
Gemfile
2 2

  
3 3
gemspec
4 4

  
5
gem 'apipie-bindings', :path => "../apipie-bindings"
6
gem 'hammer_cli', :path => "../hammer-cli"
7
gem 'hammer_cli_foreman', :path => "../hammer-cli-foreman"
8
gem 'hammer_cli_katello', :path => "../hammer-cli-katello"
9
gem 'hammer_cli_foreman_tasks', :path => "../hammer-cli-foreman-tasks"
10

  
11 5
group :test do
12 6
  gem 'rake'
13 7
  gem 'thor'
......
17 11
  gem 'mocha'
18 12
  gem 'ci_reporter'
19 13
end
14

  
15
# load local gemfile
16
local_gemfile = File.join(File.dirname(__FILE__), 'Gemfile.local')
17
self.instance_eval(Bundler.read_file(local_gemfile)) if File.exist?(local_gemfile)
config/cli.modules.d/csv.template.yml
1
# :csv:
2
#   :enable_module: true
3
#   :host:          'https://localhost'
4
#   :username:      'admin'
5
#   :password:      'changeme'
config/cli.modules.d/foreman.template.yml
1
# :foreman:
2
#   :enable_module: true
3
#   :host:          'https://localhost'
4
#   :username:      'admin'
5
#   :password:      'changeme'
config/cli.modules.d/katello.template.yml
1
# :katello:
2
#   :enable_module: true
3
#   :host:          'https://localhost'
4
#   :username:      'admin'
5
#   :password:      'changeme'
config/cli_config.template.yml
1
:ui:
2
  :interactive: true
3
  :per_page: 20
4
  :history_file: './log/history'
5

  
6
:watch_plain: true # enable/disable color output of logger in Clamp commands
7

  
8
:log_dir: './log'
9
:log_level: 'error'
10
:log_api_calls: false
11
:log_size: 5 # MB
hammer-it
1
#!/bin/csh -f
2

  
3
# Replaced with: rake test TEST=test/setup_test.rb
4

  
5
bundle exec hammer -v csv:organizations      --csv-file test/data/organizations.csv
6
bundle exec hammer -v csv:users              --csv-file test/data/users.csv
7
bundle exec hammer -v csv:operatingsystems   --csv-file test/data/operatingsystems.csv
8
bundle exec hammer -v csv:architectures      --csv-file test/data/architectures.csv
9
bundle exec hammer -v csv:partitiontables    --csv-file test/data/partitiontables.csv
10
bundle exec hammer -v csv:domains            --csv-file test/data/domains.csv
11
bundle exec hammer -v csv:puppetenvironments --csv-file test/data/puppetenvironments.csv
12
bundle exec hammer -v csv:hosts              --csv-file test/data/hosts.csv
13
bundle exec hammer -v csv:puppetfacts        --csv-file test/data/puppetfacts.csv
14

  
15
bundle exec hammer subscription upload --organization-id megacorp --file ~/Downloads/megacorp.zip
16
echo "Waiting 30s for manifest upload to complete..."
17
sleep 30
18
echo "...continuing"
19

  
20
bundle exec hammer -v csv:products           --csv-file test/data/products.csv
21

  
22
bundle exec hammer -v csv:lifecycleenv       --csv-file test/data/lifecycleenvironments.csv
23
bundle exec hammer -v csv:systemgroups       --csv-file test/data/systemgroups.csv
24
bundle exec hammer -v csv:systems            --csv-file test/data/systems.csv
25
bundle exec hammer -v csv:activationkeys     --csv-file test/data/activationkeys.csv
26
bundle exec hammer -v csv:roles              --csv-file test/data/roles.csv
hammer_cli_csv.gemspec
15 15
  spec.files = Dir["lib/**/*.rb"]
16 16
  spec.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17 17

  
18
  spec.add_dependency("hammer_cli")
18
  spec.add_dependency('hammer_cli')
19
  spec.add_dependency('hammer_cli_foreman')
20
  spec.add_dependency('hammer_cli_katello')
21
  #spec.add_dependency('hammer_cli_foreman_tasks', '0.0.2')
22

  
19 23
end
lib/hammer_cli_csv/lifecycle_environments.rb
29 29
  class CsvCommand
30 30
    class LifecycleEnvironmentsCommand < BaseCommand
31 31

  
32
      command_name "lifecycle-environment"
32
      command_name "lifecycle-environments"
33 33
      desc         "import or export lifecycle environments"
34 34

  
35 35
      LABEL = "Label"
lib/hammer_cli_csv/products.rb
203 203

  
204 204
      def content_type(repository_type)
205 205
        case repository_type
206
          when /Yum/
206
          when /yum/i
207 207
            'yum'
208
          when /Puppet/
208
          when /puppet/i
209 209
            'puppet'
210 210
          else
211 211
          raise "Unrecognized repository type '#{repository_type}'"
test/config.template.yml
1
:csv:
2
  :enable_module: true
3
  :host:          'https://localhost'
4
  :username:      'admin'
5
  :password:      'changeme'
6

  
7
:foreman:
8
  :enable_module: true
9
  :host:          'https://localhost'
10
  :username:      'admin'
11
  :password:      'changeme'
12

  
13
:katello:
14
  :enable_module: true
15
  :host:          'https://localhost'
16
  :username:      'admin'
17
  :password:      'changeme'

Also available in: Unified diff