hammer_cli_sam 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile ADDED
@@ -0,0 +1,20 @@
1
+ require 'bundler/gem_tasks'
2
+
3
+ begin
4
+ require 'rubocop/rake_task'
5
+ RuboCop::RakeTask.new
6
+
7
+ desc "Runs Rubocop style checker with xml output for Jenkins"
8
+ task 'rubocop:jenkins' do
9
+ system("bundle exec rubocop \
10
+ --require rubocop/formatter/checkstyle_formatter \
11
+ --format Rubocop::Formatter::CheckstyleFormatter \
12
+ --no-color --out rubocop.xml")
13
+ end
14
+ rescue => _
15
+ puts "Rubocop not loaded."
16
+ end
17
+
18
+ task :default do
19
+ Rake::Task['rubocop'].execute
20
+ end
@@ -0,0 +1,133 @@
1
+ hammer > shell
2
+ hammer > console
3
+ hammer > full-help
4
+ hammer > command-tree
5
+ hammer > auth
6
+ hammer > auth > login
7
+ hammer > auth > logout
8
+ hammer > auth > status
9
+ hammer > auth-source
10
+ hammer > auth-source > ldap
11
+ hammer > auth-source > ldap > list
12
+ hammer > auth-source > ldap > info
13
+ hammer > auth-source > ldap > create
14
+ hammer > auth-source > ldap > delete
15
+ hammer > auth-source > ldap > update
16
+ hammer > filter
17
+ hammer > filter > list
18
+ hammer > filter > info
19
+ hammer > filter > create
20
+ hammer > filter > update
21
+ hammer > filter > delete
22
+ hammer > filter > available-permissions
23
+ hammer > filter > available-resources
24
+ hammer > location
25
+ hammer > location > list
26
+ hammer > location > info
27
+ hammer > location > create
28
+ hammer > location > update
29
+ hammer > location > delete
30
+ hammer > location > add-user
31
+ hammer > location > remove-user
32
+ hammer > location > add-organization
33
+ hammer > location > remove-organization
34
+ hammer > role
35
+ hammer > role > list
36
+ hammer > role > filters
37
+ hammer > role > create
38
+ hammer > role > update
39
+ hammer > role > delete
40
+ hammer > user
41
+ hammer > user > list
42
+ hammer > user > info
43
+ hammer > user > create
44
+ hammer > user > update
45
+ hammer > user > delete
46
+ hammer > user > add-role
47
+ hammer > user > remove-role
48
+ hammer > user-group
49
+ hammer > user-group > list
50
+ hammer > user-group > info
51
+ hammer > user-group > create
52
+ hammer > user-group > update
53
+ hammer > user-group > delete
54
+ hammer > user-group > add-role
55
+ hammer > user-group > remove-role
56
+ hammer > user-group > add-user
57
+ hammer > user-group > remove-user
58
+ hammer > user-group > add-user-group
59
+ hammer > user-group > remove-user-group
60
+ hammer > user-group > external
61
+ hammer > user-group > external > list
62
+ hammer > user-group > external > info
63
+ hammer > user-group > external > refresh
64
+ hammer > user-group > external > create
65
+ hammer > user-group > external > update
66
+ hammer > user-group > external > delete
67
+ hammer > task
68
+ hammer > task > progress
69
+ hammer > activation-key
70
+ hammer > activation-key > list
71
+ hammer > activation-key > info
72
+ hammer > activation-key > create
73
+ hammer > activation-key > update
74
+ hammer > activation-key > delete
75
+ hammer > activation-key > subscriptions
76
+ hammer > activation-key > add-subscription
77
+ hammer > activation-key > remove-subscription
78
+ hammer > activation-key > host-collections
79
+ hammer > activation-key > add-host-collection
80
+ hammer > activation-key > remove-host-collection
81
+ hammer > organization
82
+ hammer > organization > list
83
+ hammer > organization > info
84
+ hammer > organization > update
85
+ hammer > organization > create
86
+ hammer > organization > delete
87
+ hammer > organization > add-user
88
+ hammer > organization > remove-user
89
+ hammer > ping
90
+ hammer > product
91
+ hammer > product > list
92
+ hammer > product > info
93
+ hammer > product > synchronize
94
+ hammer > product > set-sync-plan
95
+ hammer > product > remove-sync-plan
96
+ hammer > repository
97
+ hammer > repository > list
98
+ hammer > repository > info
99
+ hammer > repository > synchronize
100
+ hammer > repository-set
101
+ hammer > repository-set > list
102
+ hammer > repository-set > info
103
+ hammer > repository-set > available-repositories
104
+ hammer > repository-set > enable
105
+ hammer > repository-set > disable
106
+ hammer > subscription
107
+ hammer > subscription > list
108
+ hammer > subscription > upload
109
+ hammer > subscription > delete-manifest
110
+ hammer > subscription > refresh-manifest
111
+ hammer > subscription > manifest-history
112
+ hammer > sync-plan
113
+ hammer > sync-plan > list
114
+ hammer > sync-plan > info
115
+ hammer > sync-plan > create
116
+ hammer > sync-plan > update
117
+ hammer > sync-plan > delete
118
+ hammer > host-collection
119
+ hammer > host-collection > list
120
+ hammer > host-collection > create
121
+ hammer > host-collection > info
122
+ hammer > host-collection > content-hosts
123
+ hammer > host-collection > copy
124
+ hammer > host-collection > update
125
+ hammer > host-collection > delete
126
+ hammer > host-collection > add-content-host
127
+ hammer > host-collection > remove-content-host
128
+ hammer > content-host
129
+ hammer > content-host > list
130
+ hammer > content-host > info
131
+ hammer > content-host > update
132
+ hammer > content-host > delete
133
+ hammer > content-host > tasks
@@ -0,0 +1,28 @@
1
+ # -*- encoding: utf-8 -*-
2
+ $LOAD_PATH.unshift(File.expand_path('../lib', __FILE__))
3
+
4
+ require 'hammer_cli_sam/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.authors = ['Adam Price']
8
+ spec.email = ['katello@lists.fedorahosted.org']
9
+ spec.license = "GPL-3"
10
+ spec.description = 'Hammer-CLI-SAM is a Hammer module which provides connectivity' \
11
+ ' to a SAM server.'
12
+ spec.summary = 'SAM commands for Hammer'
13
+ spec.homepage = 'http://github.com/Katello/hammer-cli-sam'
14
+
15
+ spec.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
16
+
17
+ spec.test_files = `git ls-files -- {test,spec,features}/*`.split($INPUT_RECORD_SEPARATOR)
18
+
19
+ spec.name = 'hammer_cli_sam'
20
+ spec.require_paths = %w(lib)
21
+ spec.version = HammerCLISAM.version
22
+
23
+ spec.add_dependency 'hammer_cli_katello', '~> 0.0.6'
24
+
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rubocop', '0.24.1'
27
+ spec.add_development_dependency 'rubocop-checkstyle_formatter'
28
+ end
@@ -0,0 +1,45 @@
1
+ module HammerCLISAM
2
+
3
+ HammerCLI::MainCommand.find_subcommand('activation-key').subcommand_class
4
+
5
+ module ActivationKeyCommand
6
+
7
+ class CreateCommand < HammerCLIKatello::ActivationKeyCommand::CreateCommand
8
+ include HammerCLISAM::ExcludeOptions
9
+
10
+ exclude_options(:environment, :content_view)
11
+ end
12
+
13
+ class ListCommand < HammerCLIKatello::ActivationKeyCommand::ListCommand
14
+ include HammerCLISAM::ExcludeOptions
15
+
16
+ exclude_options(:environment, :content_view)
17
+ end
18
+
19
+ class UpdateCommand < HammerCLIKatello::ActivationKeyCommand::UpdateCommand
20
+ include HammerCLISAM::ExcludeOptions
21
+
22
+ exclude_options(:environment, :content_view)
23
+ end
24
+
25
+ end
26
+
27
+ HammerCLIKatello::ActivationKeyCommand.subcommand!(
28
+ HammerCLIKatello::ActivationKeyCommand::CreateCommand.command_name,
29
+ HammerCLIKatello::ActivationKeyCommand::CreateCommand.desc,
30
+ HammerCLISAM::ActivationKeyCommand::CreateCommand
31
+ )
32
+
33
+ HammerCLIKatello::ActivationKeyCommand.subcommand!(
34
+ HammerCLIKatello::ActivationKeyCommand::ListCommand.command_name,
35
+ HammerCLIKatello::ActivationKeyCommand::ListCommand.desc,
36
+ HammerCLISAM::ActivationKeyCommand::ListCommand
37
+ )
38
+
39
+ HammerCLIKatello::ActivationKeyCommand.subcommand!(
40
+ HammerCLIKatello::ActivationKeyCommand::UpdateCommand.command_name,
41
+ HammerCLIKatello::ActivationKeyCommand::UpdateCommand.desc,
42
+ HammerCLISAM::ActivationKeyCommand::UpdateCommand
43
+ )
44
+
45
+ end
@@ -0,0 +1,42 @@
1
+ module HammerCLISAM
2
+
3
+ commands = %w(
4
+ create
5
+ package
6
+ package-group
7
+ errata
8
+ )
9
+
10
+ commands.each do |cmd|
11
+ HammerCLI::MainCommand.find_subcommand('content-host').subcommand_class.remove_subcommand(cmd)
12
+ end
13
+
14
+ module ContentHostCommand
15
+
16
+ class ListCommand < HammerCLIKatello::ContentHostCommand::ListCommand
17
+ include HammerCLISAM::ExcludeOptions
18
+
19
+ exclude_options(:environment)
20
+ end
21
+
22
+ class UpdateCommand < HammerCLIKatello::ContentHostCommand::UpdateCommand
23
+ include HammerCLISAM::ExcludeOptions
24
+
25
+ exclude_options(:environment, :content_view)
26
+ end
27
+
28
+ end
29
+
30
+ HammerCLIKatello::ContentHostCommand.subcommand!(
31
+ HammerCLIKatello::ContentHostCommand::ListCommand.command_name,
32
+ HammerCLIKatello::ContentHostCommand::ListCommand.desc,
33
+ HammerCLISAM::ContentHostCommand::ListCommand
34
+ )
35
+
36
+ HammerCLIKatello::ContentHostCommand.subcommand!(
37
+ HammerCLIKatello::ContentHostCommand::UpdateCommand.command_name,
38
+ HammerCLIKatello::ContentHostCommand::UpdateCommand.desc,
39
+ HammerCLISAM::ContentHostCommand::UpdateCommand
40
+ )
41
+
42
+ end
@@ -0,0 +1,37 @@
1
+ module HammerCLISAM
2
+
3
+ module ExcludeOptions
4
+
5
+ def self.included(base)
6
+ base.extend ClassMethods
7
+ end
8
+
9
+ module ClassMethods
10
+
11
+ # when #exclude_options is called on a command class,
12
+ # we take those options and generate a #recognised_options
13
+ # method overriding the parent's #recognised_options to
14
+ # pull out the options we don't want.
15
+ #
16
+ # it probably seems odd that we're calling #instance_eval here
17
+ # if this is to be modifying a class. Since we're in the
18
+ # ClassMethods module while will be applied to the class,
19
+ # in the current scope, self *is* the class, so our current
20
+ # instance *is* the class definition.
21
+ def exclude_options(*options)
22
+ instance_eval <<-eoruby
23
+ def recognised_options
24
+ super.reject! do |opt|
25
+ #{options.map { |opt| /#{opt.to_s}/ }.inspect}.reduce(false) do |reduced, regex|
26
+ reduced || (opt.attribute_name =~ regex)
27
+ end
28
+ end
29
+ end
30
+ eoruby
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+
37
+ end
@@ -0,0 +1,26 @@
1
+ module HammerCLISAM
2
+
3
+ commands = %w(
4
+ add-hostgroup
5
+ remove-hostgroup
6
+ add-environment
7
+ remove-environment
8
+ add-domain
9
+ remove-domain
10
+ add-medium
11
+ remove-medium
12
+ add-subnet
13
+ remove-subnet
14
+ add-compute-resource
15
+ remove-compute-resource
16
+ add-smart-proxy
17
+ remove-smart-proxy
18
+ add-config-template
19
+ remove-config-template
20
+ )
21
+
22
+ commands.each do |cmd|
23
+ HammerCLI::MainCommand.find_subcommand('location').subcommand_class.remove_subcommand(cmd)
24
+ end
25
+
26
+ end
@@ -0,0 +1,70 @@
1
+ module HammerCLISAM
2
+
3
+ commands = %w(
4
+ add-compute-resource
5
+ add-config-template
6
+ add-domain
7
+ add-environment
8
+ add-hostgroup
9
+ add-medium
10
+ add-smart-proxy
11
+ add-subnet
12
+ remove-compute-resource
13
+ remove-config-template
14
+ remove-domain
15
+ remove-environment
16
+ remove-hostgroup
17
+ remove-medium
18
+ remove-smart-proxy
19
+ remove-subnet
20
+ )
21
+
22
+ commands.each do |cmd|
23
+ HammerCLI::MainCommand.find_subcommand('organization').subcommand_class.remove_subcommand(cmd)
24
+ end
25
+
26
+ module Organization
27
+
28
+ class CreateCommand < HammerCLIKatello::Organization::CreateCommand
29
+ include HammerCLISAM::ExcludeOptions
30
+
31
+ exclude_options(:compute_resource,
32
+ :config_template,
33
+ :domain,
34
+ :hostgroup,
35
+ :environment,
36
+ :media,
37
+ :realm,
38
+ :smart_proxy,
39
+ :subnet)
40
+ end
41
+
42
+ class UpdateCommand < HammerCLIKatello::Organization::UpdateCommand
43
+ include HammerCLISAM::ExcludeOptions
44
+
45
+ exclude_options(:compute_resource,
46
+ :config_template,
47
+ :domain,
48
+ :hostgroup,
49
+ :environment,
50
+ :media,
51
+ :realm,
52
+ :smart_proxy,
53
+ :subnet)
54
+ end
55
+
56
+ end
57
+
58
+ HammerCLIKatello::Organization.subcommand!(
59
+ HammerCLIKatello::Organization::CreateCommand.command_name,
60
+ HammerCLIKatello::Organization::CreateCommand.desc,
61
+ HammerCLISAM::Organization::CreateCommand
62
+ )
63
+
64
+ HammerCLIKatello::Organization.subcommand!(
65
+ HammerCLIKatello::Organization::UpdateCommand.command_name,
66
+ HammerCLIKatello::Organization::UpdateCommand.desc,
67
+ HammerCLISAM::Organization::UpdateCommand
68
+ )
69
+
70
+ end
@@ -0,0 +1,41 @@
1
+ module HammerCLISAM
2
+
3
+ commands = %w(
4
+ create
5
+ delete
6
+ update
7
+ )
8
+
9
+ commands.each do |cmd|
10
+ HammerCLI::MainCommand.find_subcommand('product').subcommand_class.remove_subcommand(cmd)
11
+ end
12
+
13
+ module Product
14
+
15
+ class RemoveSyncPlanCommand < HammerCLIKatello::Product::RemoveSyncPlanCommand
16
+ include HammerCLISAM::ExcludeOptions
17
+
18
+ exclude_options(:gpg_key)
19
+ end
20
+
21
+ class SetSyncPlanCommand < HammerCLIKatello::Product::SetSyncPlanCommand
22
+ include HammerCLISAM::ExcludeOptions
23
+
24
+ exclude_options(:gpg_key)
25
+ end
26
+
27
+ end
28
+
29
+ HammerCLIKatello::Product.subcommand!(
30
+ HammerCLIKatello::Product::RemoveSyncPlanCommand.command_name,
31
+ HammerCLIKatello::Product::RemoveSyncPlanCommand.desc,
32
+ HammerCLISAM::Product::RemoveSyncPlanCommand
33
+ )
34
+
35
+ HammerCLIKatello::Product.subcommand!(
36
+ HammerCLIKatello::Product::SetSyncPlanCommand.command_name,
37
+ HammerCLIKatello::Product::SetSyncPlanCommand.desc,
38
+ HammerCLISAM::Product::SetSyncPlanCommand
39
+ )
40
+
41
+ end
@@ -0,0 +1,32 @@
1
+ module HammerCLISAM
2
+
3
+ commands = %w(
4
+ create
5
+ delete
6
+ update
7
+ upload-content
8
+ )
9
+
10
+ commands.each do |cmd|
11
+ HammerCLI::MainCommand.find_subcommand('repository').subcommand_class.remove_subcommand(cmd)
12
+ end
13
+
14
+ module Repository
15
+
16
+ class ListCommand < HammerCLIKatello::Repository::ListCommand
17
+ include HammerCLISAM::ExcludeOptions
18
+
19
+ exclude_options(:content_view,
20
+ :library,
21
+ :environment)
22
+ end
23
+
24
+ end
25
+
26
+ HammerCLIKatello::Repository.subcommand!(
27
+ HammerCLIKatello::Repository::ListCommand.command_name,
28
+ HammerCLIKatello::Repository::ListCommand.desc,
29
+ HammerCLISAM::Repository::ListCommand
30
+ )
31
+
32
+ end
@@ -0,0 +1,7 @@
1
+ module HammerCLISAM
2
+
3
+ def self.version
4
+ @version ||= Gem::Version.new('0.0.1')
5
+ end
6
+
7
+ end
@@ -0,0 +1,47 @@
1
+ require 'hammer_cli_katello'
2
+
3
+ module HammerCLISAM
4
+
5
+ commands = %w(
6
+ architecture
7
+ capsule
8
+ compute-resource
9
+ content-view
10
+ domain
11
+ environment
12
+ erratum
13
+ fact
14
+ global-parameter
15
+ gpg
16
+ host
17
+ hostgroup
18
+ lifecycle-environment
19
+ medium
20
+ model
21
+ os
22
+ package
23
+ package-group
24
+ partition-table
25
+ proxy
26
+ puppet-class
27
+ puppet-module
28
+ report
29
+ sc-param
30
+ subnet
31
+ template
32
+ )
33
+
34
+ commands.each do |cmd|
35
+ HammerCLI::MainCommand.remove_subcommand(cmd)
36
+ end
37
+
38
+ require 'hammer_cli_sam/exclude_mixin'
39
+
40
+ require 'hammer_cli_sam/activation_key'
41
+ require 'hammer_cli_sam/content_host'
42
+ require 'hammer_cli_sam/location'
43
+ require 'hammer_cli_sam/organization'
44
+ require 'hammer_cli_sam/product'
45
+ require 'hammer_cli_sam/repository'
46
+
47
+ end
metadata ADDED
@@ -0,0 +1,120 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hammer_cli_sam
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Adam Price
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-10-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: hammer_cli_katello
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.6
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.6
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.24.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '='
53
+ - !ruby/object:Gem::Version
54
+ version: 0.24.1
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-checkstyle_formatter
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ description: Hammer-CLI-SAM is a Hammer module which provides connectivity to a SAM
70
+ server.
71
+ email:
72
+ - katello@lists.fedorahosted.org
73
+ executables: []
74
+ extensions: []
75
+ extra_rdoc_files: []
76
+ files:
77
+ - .gitignore
78
+ - .rubocop.yml
79
+ - .travis.yml
80
+ - Gemfile
81
+ - LICENSE
82
+ - README.md
83
+ - Rakefile
84
+ - extra/commandtree.txt
85
+ - hammer_cli_sam.gemspec
86
+ - lib/hammer_cli_sam.rb
87
+ - lib/hammer_cli_sam/activation_key.rb
88
+ - lib/hammer_cli_sam/content_host.rb
89
+ - lib/hammer_cli_sam/exclude_mixin.rb
90
+ - lib/hammer_cli_sam/location.rb
91
+ - lib/hammer_cli_sam/organization.rb
92
+ - lib/hammer_cli_sam/product.rb
93
+ - lib/hammer_cli_sam/repository.rb
94
+ - lib/hammer_cli_sam/version.rb
95
+ homepage: http://github.com/Katello/hammer-cli-sam
96
+ licenses:
97
+ - GPL-3
98
+ metadata: {}
99
+ post_install_message:
100
+ rdoc_options: []
101
+ require_paths:
102
+ - lib
103
+ required_ruby_version: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - ! '>='
106
+ - !ruby/object:Gem::Version
107
+ version: '0'
108
+ required_rubygems_version: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ! '>='
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
113
+ requirements: []
114
+ rubyforge_project:
115
+ rubygems_version: 2.2.2
116
+ signing_key:
117
+ specification_version: 4
118
+ summary: SAM commands for Hammer
119
+ test_files: []
120
+ has_rdoc: