hammer_cli_foreman 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of hammer_cli_foreman might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/doc/developer_docs.md +13 -0
- data/doc/name_id_resolution.md +50 -0
- data/doc/option_builder.md +48 -0
- data/doc/release_notes.md +64 -0
- data/lib/hammer_cli_foreman.rb +100 -23
- data/lib/hammer_cli_foreman/architecture.rb +0 -1
- data/lib/hammer_cli_foreman/associating_commands.rb +71 -0
- data/lib/hammer_cli_foreman/auth.rb +0 -1
- data/lib/hammer_cli_foreman/commands.rb +112 -80
- data/lib/hammer_cli_foreman/common_parameter.rb +5 -3
- data/lib/hammer_cli_foreman/compute_resource.rb +0 -2
- data/lib/hammer_cli_foreman/dependency_resolver.rb +32 -0
- data/lib/hammer_cli_foreman/domain.rb +0 -1
- data/lib/hammer_cli_foreman/environment.rb +0 -2
- data/lib/hammer_cli_foreman/exception_handler.rb +3 -3
- data/lib/hammer_cli_foreman/fact.rb +1 -1
- data/lib/hammer_cli_foreman/filter.rb +102 -0
- data/lib/hammer_cli_foreman/host.rb +5 -7
- data/lib/hammer_cli_foreman/hostgroup.rb +4 -3
- data/lib/hammer_cli_foreman/id_resolver.rb +60 -51
- data/lib/hammer_cli_foreman/image.rb +0 -1
- data/lib/hammer_cli_foreman/location.rb +7 -3
- data/lib/hammer_cli_foreman/media.rb +1 -1
- data/lib/hammer_cli_foreman/model.rb +1 -1
- data/lib/hammer_cli_foreman/operating_system.rb +4 -6
- data/lib/hammer_cli_foreman/option_builders.rb +285 -0
- data/lib/hammer_cli_foreman/organization.rb +7 -3
- data/lib/hammer_cli_foreman/param_filters.rb +61 -0
- data/lib/hammer_cli_foreman/parameter.rb +5 -3
- data/lib/hammer_cli_foreman/partition_table.rb +1 -1
- data/lib/hammer_cli_foreman/puppet_class.rb +1 -1
- data/lib/hammer_cli_foreman/references.rb +16 -0
- data/lib/hammer_cli_foreman/report.rb +1 -1
- data/lib/hammer_cli_foreman/role.rb +78 -0
- data/lib/hammer_cli_foreman/smart_class_parameter.rb +1 -1
- data/lib/hammer_cli_foreman/smart_proxy.rb +17 -2
- data/lib/hammer_cli_foreman/smart_variables.rb +111 -0
- data/lib/hammer_cli_foreman/subnet.rb +1 -1
- data/lib/hammer_cli_foreman/template.rb +10 -4
- data/lib/hammer_cli_foreman/user.rb +5 -1
- data/lib/hammer_cli_foreman/usergroup.rb +58 -0
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/locale/Makefile +12 -11
- data/locale/README.md +18 -0
- data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en/hammer-cli-foreman.po +1584 -0
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/hammer-cli-foreman.po +1975 -0
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/hammer-cli-foreman.po +1976 -0
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/hammer-cli-foreman.po +1976 -0
- data/locale/hammer-cli-foreman.pot +1197 -787
- data/test/unit/api_test.rb +25 -0
- data/test/unit/architecture_test.rb +1 -0
- data/test/unit/commands_test.rb +18 -0
- data/test/unit/common_parameter_test.rb +1 -0
- data/test/unit/compute_resource_test.rb +1 -0
- data/test/unit/data/1.6/foreman_api.json +1 -0
- data/test/unit/dependency_resolver_test.rb +42 -0
- data/test/unit/domain_test.rb +1 -0
- data/test/unit/environment_test.rb +1 -0
- data/test/unit/fact_test.rb +1 -0
- data/test/unit/filter_test.rb +133 -0
- data/test/unit/helpers/command.rb +0 -13
- data/test/unit/host_test.rb +3 -0
- data/test/unit/hostgroup_test.rb +1 -0
- data/test/unit/id_resolver_test.rb +21 -68
- data/test/unit/image_test.rb +1 -1
- data/test/unit/location_test.rb +2 -0
- data/test/unit/media_test.rb +2 -0
- data/test/unit/model_test.rb +1 -0
- data/test/unit/operating_system_test.rb +1 -0
- data/test/unit/option_builders_test.rb +543 -0
- data/test/unit/organization_test.rb +1 -0
- data/test/unit/param_filters_test.rb +143 -0
- data/test/unit/partition_table_test.rb +1 -0
- data/test/unit/puppet_class_test.rb +1 -0
- data/test/unit/report_test.rb +1 -0
- data/test/unit/role_test.rb +94 -0
- data/test/unit/smart_class_parameter_test.rb +1 -0
- data/test/unit/smart_proxy_test.rb +14 -1
- data/test/unit/subnet_test.rb +1 -0
- data/test/unit/template_test.rb +1 -0
- data/test/unit/test_helper.rb +1 -1
- data/test/unit/user_test.rb +1 -0
- data/test/unit/usergroup_test.rb +80 -0
- metadata +50 -7
- data/lib/hammer_cli_foreman/searchables_option_builder.rb +0 -99
- data/test/unit/searchables_option_builder_test.rb +0 -172
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97a1846e244c06dbf22be733fb72c36c84d02176
|
4
|
+
data.tar.gz: 6bf9b662b14a0316bcc6bc896244776c8d61a3a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c970a3dd2cb46bd075b3117e17a0a4cb048e37b1e48a8335ccbd8a2cd20731a1289668deed841a7414f416941debd688e9859e3e9d2b67a6ed0ef21a965f054f
|
7
|
+
data.tar.gz: 1a2930c88886e9888de710a80b520d41ec26152c7f294fc37b206548a05c0382594614705e1962da1ebcc18d1baa16bd448708569140568255c85f3e56fc4024
|
data/README.md
CHANGED
@@ -4,6 +4,7 @@ Foreman commands for Hammer CLI
|
|
4
4
|
This [Hammer CLI](https://github.com/theforeman/hammer-cli) plugin contains
|
5
5
|
set of commands for [Foreman](http://theforeman.org/).
|
6
6
|
|
7
|
+
Check out the [release notes](doc/release_notes.md#release-notes) to see what's new in the latest version.
|
7
8
|
|
8
9
|
Documentation
|
9
10
|
-------------
|
@@ -14,8 +15,8 @@ Documentation
|
|
14
15
|
How to run
|
15
16
|
----------
|
16
17
|
|
17
|
-
|
18
|
-
See [Hammer CLI
|
18
|
+
We build rpms, debs and gems. Alternatively you can install hammer from a git checkout.
|
19
|
+
See our [Hammer CLI installation and configuration instuctions](https://github.com/theforeman/hammer-cli/blob/master/doc/installation.md#installation).
|
19
20
|
|
20
21
|
|
21
22
|
Having issues?
|
@@ -25,7 +26,14 @@ If one of hammer commands doesn't work as you would expect, you can run `hammer
|
|
25
26
|
full debug output from the loggers. It should give you an idea what went wrong.
|
26
27
|
|
27
28
|
If you have questions, don't hesitate to contact us on `foreman-users@googlegroups.com` or
|
28
|
-
`
|
29
|
+
the `Freenode#theforeman` IRC channel.
|
30
|
+
|
31
|
+
|
32
|
+
Developer Docs
|
33
|
+
--------------
|
34
|
+
If you're planning to contribute,
|
35
|
+
look at [the development documentation](doc/developer_docs.md#hammer-development-docs).
|
36
|
+
|
29
37
|
|
30
38
|
How to test
|
31
39
|
------------
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Hammer-CLI-Foreman Development Docs
|
2
|
+
===================================
|
3
|
+
|
4
|
+
There's a lot of useful information in
|
5
|
+
[development documentation of Hammer Core](https://github.com/theforeman/hammer-cli/blob/master/doc/developer_docs.md#hammer-development-docs).
|
6
|
+
Studying it first can help you to understand the basic principles.
|
7
|
+
|
8
|
+
Foreman plugin extends the Hammer Core in following areas:
|
9
|
+
- [Building options](option_builder.md#option-builder)
|
10
|
+
- [Automatic name resolution](name_id_resolution.md#name---id-resolution)
|
11
|
+
|
12
|
+
It's recommended that you set `:refresh_cache: true` in the plugin settings if
|
13
|
+
engaging in API development to enable aggressive apidoc cache checking.
|
@@ -0,0 +1,50 @@
|
|
1
|
+
Name to ID resolution
|
2
|
+
=====================
|
3
|
+
|
4
|
+
How it works
|
5
|
+
------------
|
6
|
+
|
7
|
+
The Foreman's API uses unique numeric IDs to reference resources. While they are very easy to deal with in scripts, human users appreciate more readable identifiers. Most of the Foreman's resources are also searchable by name. `HammerCLIForeman`'s commands use ID resolution to make a developer's life easier by handling the translation of names to numeric IDs.
|
8
|
+
|
9
|
+
The ID resolution process consists of two parts:
|
10
|
+
- building correct parameters (option builders are described [here](https://github.com/theforeman/hammer-cli-foreman/blob/master/doc/option_builder.md#option-builders))
|
11
|
+
- the translation process itself ([IdResolver](https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/id_resolver.rb) takes care of that)
|
12
|
+
|
13
|
+
ID resolution step by step
|
14
|
+
--------------------------
|
15
|
+
|
16
|
+
`IdResolver` implements the method `<resource_name>_id(cli_options)` for each of the resources. Under the hood, the method:
|
17
|
+
- returns `cli_options['option_id']` if it's not nil
|
18
|
+
- looks at `index` method's parameters, finds all required `*_id` params there and makes sure they're present (if not it tries to resolve them recursively)
|
19
|
+
- extends the original options with a `search` field that searches for the name
|
20
|
+
- calls the `index` method and returns the result
|
21
|
+
|
22
|
+
It can end up with an exception when:
|
23
|
+
- the options necessary for search (typically name) are not present
|
24
|
+
- one of the dependent resources couldn't be found
|
25
|
+
- the resource was not found
|
26
|
+
- more resources were found
|
27
|
+
|
28
|
+
APIdoc requirements
|
29
|
+
-------------------
|
30
|
+
|
31
|
+
The builtin name to id resolution in `hammer-cli-foreman` works if the following conditions are met:
|
32
|
+
- the API parameters that need to be resolved must respect `<resource_name>_id` format
|
33
|
+
- the resource's API controller needs to have the action `index`
|
34
|
+
- the `index` action has to support searching by name
|
35
|
+
- the `index` action's docs mention all required `*_id` parameters
|
36
|
+
- all the above conditions have been fulfilled for any resource referenced from the previous `index` action
|
37
|
+
|
38
|
+
Command requirements
|
39
|
+
--------------------
|
40
|
+
|
41
|
+
Option builders should take care of all the requirements for you, but just for the sake of completeness:
|
42
|
+
- the command's action needs to have parameter `id`
|
43
|
+
- the command needs to have defined options `--id`, `--name` and possibly options for other identifiers of the primary resource (resource specified in the command)
|
44
|
+
- the command needs to define options `--<resource_name>-id`, `--<resource_name>` (but with the reader method `option<resource_name>_name`!) and possibly others for remaining identifiers of all the dependent resources
|
45
|
+
|
46
|
+
Behaviour tuning
|
47
|
+
----------------
|
48
|
+
|
49
|
+
Most of the resources are searchable by name. However there are exceptions that either don't have a name or offer more searchable fields. In such cases you have to update [the definition of searchable fields](https://github.com/theforeman/hammer-cli-foreman/blob/master/lib/hammer_cli_foreman/id_resolver.rb#L31).
|
50
|
+
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Option Builders
|
2
|
+
===============
|
3
|
+
|
4
|
+
Commands in the Foreman plugin have by default option builders for:
|
5
|
+
- parameters of the related ApiPie action
|
6
|
+
- parameters necessary for identication of the resources appearing in the action
|
7
|
+
|
8
|
+
The latter creates options for identifying resources based on the action's parameters
|
9
|
+
and definition of the resource's searchable fields (_any field that is unique either globally
|
10
|
+
or in a scope and is accessible in scoped search at the same time_).
|
11
|
+
The searchables definition is kept in [a single mapping object](../lib/hammer_cli_foreman/id_resolver.rb).
|
12
|
+
|
13
|
+
__The builder creates:__
|
14
|
+
|
15
|
+
1. An identifier option for each of the resource's searchable fields if the action takes parameter `:id`.
|
16
|
+
E.g. `--id`, `--name`, `--label`.
|
17
|
+
1. Prefixed identifier options for each parameter ending with `_id` that appears in the action.
|
18
|
+
E.g. `--organization` (first searchable field
|
19
|
+
is considered default and the field name is omitted), `--organization-id`, `--organization-label`.
|
20
|
+
1. Prefixed identifier options as above for each __required__ parameter ending with `_id` that appears in index actions
|
21
|
+
of the resources found in the previous step. These options are required for searching resources that appear in the action.
|
22
|
+
1. Expansion continues repeating the step 3 recursively.
|
23
|
+
|
24
|
+
|
25
|
+
However, this default behavior is not always applicable. Therefore the builder
|
26
|
+
enables customizing the set of expanded resources.
|
27
|
+
|
28
|
+
See examples in the code below.
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
build_options do |o|
|
32
|
+
o.expand(:all) # will do all expansions (default)
|
33
|
+
o.expand(:none) # will not expand anything
|
34
|
+
|
35
|
+
o.expand(:all).including(:locations) # will create additional identifier
|
36
|
+
# options for locations
|
37
|
+
o.expand.including(:locations) # equivalent to the above
|
38
|
+
|
39
|
+
o.expand(:all).except(:organizations) # create identifier options for all resources
|
40
|
+
# except from organizations
|
41
|
+
|
42
|
+
o.expand.only(:architectures, :domains) # expand searchables for specific
|
43
|
+
# set of resources
|
44
|
+
|
45
|
+
# it is also possible to combine the methods
|
46
|
+
o.expand(:all).including(:locations).except(:organizations)
|
47
|
+
end
|
48
|
+
```
|
@@ -0,0 +1,64 @@
|
|
1
|
+
Release notes
|
2
|
+
=============
|
3
|
+
|
4
|
+
### 0.1.2
|
5
|
+
* Docs for name->id resolution
|
6
|
+
* Update with installation details and IRC channel
|
7
|
+
* Lazy loaded subcommands ([#6761](http://projects.theforeman.org/issues/6761))
|
8
|
+
* I18n - fix some broken subcommand description extractions
|
9
|
+
* I18n - fix strings to be properly extracted without interpolation
|
10
|
+
* I18n - add en_GB locale
|
11
|
+
* I18n - extracting new, pulling from tx
|
12
|
+
* Initial update of translations, fixed Makefile
|
13
|
+
* Fixed pagination ([#6766](http://projects.theforeman.org/issues/6766))
|
14
|
+
* Restrict ci_reporter gem to less than 2.0.0 to fix CI ([#6779](http://projects.theforeman.org/issues/6779))
|
15
|
+
* Add proxy refresh-features command ([#3387](http://projects.theforeman.org/issues/3387))
|
16
|
+
* Fixed simplecov dependences
|
17
|
+
* Params from searchables are not wrapped ([#6343](http://projects.theforeman.org/issues/6343))
|
18
|
+
* rest-client > 1.7 does not support ruby 1.8 ([#6534](http://projects.theforeman.org/issues/6534))
|
19
|
+
* Tests updated to use apidoc export for v1.6 ([#2922](http://projects.theforeman.org/issues/2922))
|
20
|
+
* Commands for managing roles, filters, permissions and usergroups ([#2922](http://projects.theforeman.org/issues/2922), [#4004](http://projects.theforeman.org/issues/4004))
|
21
|
+
* Obey refresh_cache default of false ([#6478](http://projects.theforeman.org/issues/6478))
|
22
|
+
* Creating a more generic hook for search_options ([#6203](http://projects.theforeman.org/issues/6203))
|
23
|
+
* Permit only --hostgroup when creating host ([#6335](http://projects.theforeman.org/issues/6335))
|
24
|
+
* Better option descriptions ([#6093](http://projects.theforeman.org/issues/6093))
|
25
|
+
* Mapping resource names in options ([#6092](http://projects.theforeman.org/issues/6092))
|
26
|
+
* Add --server cli option ([#6219](http://projects.theforeman.org/issues/6219))
|
27
|
+
* Fix for wrong parameters in proxy import ([#6090](http://projects.theforeman.org/issues/6090))
|
28
|
+
* Resolving ids in foreman base command ([#6090](http://projects.theforeman.org/issues/6090))
|
29
|
+
* Documentation for fine grained control over name expansion ([#5747](http://projects.theforeman.org/issues/5747))
|
30
|
+
* Fine grained control over name expansion ([#5747](http://projects.theforeman.org/issues/5747))
|
31
|
+
* Scoped options were not cleaning original options ([#5873](http://projects.theforeman.org/issues/5873))
|
32
|
+
* List actions don't resolve ids for optional parameters ([#5873](http://projects.theforeman.org/issues/5873))
|
33
|
+
* Help for associating commands is too generic ([#3512](http://projects.theforeman.org/issues/3512))
|
34
|
+
* Add pkg:generate_source task to generate gem ([#5793](http://projects.theforeman.org/issues/5793))
|
35
|
+
|
36
|
+
### 0.1.1
|
37
|
+
* Support for os default templates ([#3970](http://projects.theforeman.org/issues/3970))
|
38
|
+
* Searching all resources by name ([#4311](http://projects.theforeman.org/issues/4311))
|
39
|
+
* Listing associated resources ([#3102](http://projects.theforeman.org/issues/3102))
|
40
|
+
* Fix setting infinite timeouts ([#5209](http://projects.theforeman.org/issues/5209))
|
41
|
+
* Support for API localization ([#4478](http://projects.theforeman.org/issues/4478))
|
42
|
+
* Removed `log_api_calls` setting
|
43
|
+
|
44
|
+
### 0.1.0
|
45
|
+
* Fix for Hammer failing silently when no cache is generated ([#4849](http://projects.theforeman.org/issues/4849))
|
46
|
+
* Request localized api responses ([#4476](http://projects.theforeman.org/issues/4476))
|
47
|
+
* Setting request timeout ([#3598](http://projects.theforeman.org/issues/3598))
|
48
|
+
* Added provision_method to host creation
|
49
|
+
* Unified format of hammer commands ([#4697](http://projects.theforeman.org/issues/4697))
|
50
|
+
* Fix for server formatter failing on not symbol keys ([#4674](http://projects.theforeman.org/issues/4674))
|
51
|
+
* Support for dynamic bindings ([#3897](http://projects.theforeman.org/issues/3897))
|
52
|
+
* Adds host option to pass root password ([#4587](http://projects.theforeman.org/issues/4587))
|
53
|
+
* Adds conditional output field to show network interfaces ([#4589](http://projects.theforeman.org/issues/4589))
|
54
|
+
* i18n support ([#4473](http://projects.theforeman.org/issues/4473))
|
55
|
+
* Default value for proxy import_puppetclasses --dryrun ([#4130](http://projects.theforeman.org/issues/4130))
|
56
|
+
* Fixes DNS proxy id field in subnet list ([#4558](http://projects.theforeman.org/issues/4558))
|
57
|
+
* Fixes assigning puppet classes to hostgroups ([#4585](http://projects.theforeman.org/issues/4585))
|
58
|
+
* Adds more fields for hostgroup list ([#4588](http://projects.theforeman.org/issues/4588))
|
59
|
+
* Fixes createion and update of templates ([#4352](http://projects.theforeman.org/issues/4352))
|
60
|
+
* Fixes failing proxy import_classes ([#4517](http://projects.theforeman.org/issues/4517))
|
61
|
+
* Fixes displaying errors related to operating system commands ([#4467](http://projects.theforeman.org/issues/4467), [#4466](http://projects.theforeman.org/issues/4466), [#3360](http://projects.theforeman.org/issues/3360))
|
62
|
+
* Credentials moved to Foreman
|
63
|
+
* Unmanaged host can be now created empty ([#4358](http://projects.theforeman.org/issues/4358))
|
64
|
+
* Fixes 500 error messages being ignored ([#4355](http://projects.theforeman.org/issues/4355))
|
data/lib/hammer_cli_foreman.rb
CHANGED
@@ -12,10 +12,13 @@ module HammerCLIForeman
|
|
12
12
|
|
13
13
|
require 'hammer_cli_foreman/version'
|
14
14
|
require 'hammer_cli_foreman/output'
|
15
|
+
require 'hammer_cli_foreman/output/fields'
|
15
16
|
require 'hammer_cli_foreman/credentials'
|
16
17
|
require 'hammer_cli_foreman/exception_handler'
|
17
|
-
require 'hammer_cli_foreman/
|
18
|
+
require 'hammer_cli_foreman/option_builders'
|
19
|
+
require 'hammer_cli_foreman/param_filters'
|
18
20
|
require 'hammer_cli_foreman/id_resolver'
|
21
|
+
require 'hammer_cli_foreman/dependency_resolver'
|
19
22
|
|
20
23
|
begin
|
21
24
|
require 'hammer_cli_foreman/commands'
|
@@ -24,28 +27,102 @@ module HammerCLIForeman
|
|
24
27
|
require 'hammer_cli_foreman/parameter'
|
25
28
|
require 'hammer_cli_foreman/common_parameter'
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
30
|
+
HammerCLI::MainCommand.lazy_subcommand('auth', _("Foreman connection login/logout."),
|
31
|
+
'HammerCLIForeman::Auth', 'hammer_cli_foreman/auth'
|
32
|
+
)
|
33
|
+
|
34
|
+
HammerCLI::MainCommand.lazy_subcommand('architecture', _("Manipulate architectures."),
|
35
|
+
'HammerCLIForeman::Architecture', 'hammer_cli_foreman/architecture'
|
36
|
+
)
|
37
|
+
|
38
|
+
HammerCLI::MainCommand.lazy_subcommand('compute-resource', _("Manipulate compute resources."),
|
39
|
+
'HammerCLIForeman::ComputeResource', 'hammer_cli_foreman/compute_resource'
|
40
|
+
)
|
41
|
+
|
42
|
+
HammerCLI::MainCommand.lazy_subcommand('domain', _("Manipulate domains."),
|
43
|
+
'HammerCLIForeman::Domain', 'hammer_cli_foreman/domain'
|
44
|
+
)
|
45
|
+
|
46
|
+
HammerCLI::MainCommand.lazy_subcommand('environment', _("Manipulate environments."),
|
47
|
+
'HammerCLIForeman::Environment', 'hammer_cli_foreman/environment'
|
48
|
+
)
|
49
|
+
|
50
|
+
HammerCLI::MainCommand.lazy_subcommand('fact', _("Search facts."),
|
51
|
+
'HammerCLIForeman::Fact', 'hammer_cli_foreman/fact'
|
52
|
+
)
|
53
|
+
|
54
|
+
HammerCLI::MainCommand.lazy_subcommand('filter', _("Manage permission filters."),
|
55
|
+
'HammerCLIForeman::Filter', 'hammer_cli_foreman/filter'
|
56
|
+
)
|
57
|
+
|
58
|
+
HammerCLI::MainCommand.lazy_subcommand('host', _("Manipulate hosts."),
|
59
|
+
'HammerCLIForeman::Host', 'hammer_cli_foreman/host'
|
60
|
+
)
|
61
|
+
|
62
|
+
HammerCLI::MainCommand.lazy_subcommand('hostgroup', _("Manipulate hostgroups."),
|
63
|
+
'HammerCLIForeman::Hostgroup', 'hammer_cli_foreman/hostgroup'
|
64
|
+
)
|
65
|
+
|
66
|
+
HammerCLI::MainCommand.lazy_subcommand('location', _("Manipulate locations."),
|
67
|
+
'HammerCLIForeman::Location', 'hammer_cli_foreman/location'
|
68
|
+
)
|
69
|
+
|
70
|
+
HammerCLI::MainCommand.lazy_subcommand('medium', _("Manipulate installation media."),
|
71
|
+
'HammerCLIForeman::Medium', 'hammer_cli_foreman/media'
|
72
|
+
)
|
73
|
+
|
74
|
+
HammerCLI::MainCommand.lazy_subcommand('model', _("Manipulate hardware models."),
|
75
|
+
'HammerCLIForeman::Model', 'hammer_cli_foreman/model'
|
76
|
+
)
|
77
|
+
|
78
|
+
HammerCLI::MainCommand.lazy_subcommand('os', _("Manipulate operating system."),
|
79
|
+
'HammerCLIForeman::OperatingSystem', 'hammer_cli_foreman/operating_system'
|
80
|
+
)
|
81
|
+
|
82
|
+
HammerCLI::MainCommand.lazy_subcommand('organization', _("Manipulate organizations."),
|
83
|
+
'HammerCLIForeman::Organization', 'hammer_cli_foreman/organization'
|
84
|
+
)
|
85
|
+
|
86
|
+
HammerCLI::MainCommand.lazy_subcommand('partition-table', _("Manipulate partition tables."),
|
87
|
+
'HammerCLIForeman::PartitionTable', 'hammer_cli_foreman/partition_table'
|
88
|
+
)
|
89
|
+
|
90
|
+
HammerCLI::MainCommand.lazy_subcommand('puppet-class', _("Search puppet modules."),
|
91
|
+
'HammerCLIForeman::PuppetClass', 'hammer_cli_foreman/puppet_class'
|
92
|
+
)
|
93
|
+
|
94
|
+
HammerCLI::MainCommand.lazy_subcommand('report', _("Browse and read reports."),
|
95
|
+
'HammerCLIForeman::Report', 'hammer_cli_foreman/report'
|
96
|
+
)
|
97
|
+
|
98
|
+
HammerCLI::MainCommand.lazy_subcommand('role', _("Manage user roles."),
|
99
|
+
'HammerCLIForeman::Role', 'hammer_cli_foreman/role'
|
100
|
+
)
|
101
|
+
|
102
|
+
HammerCLI::MainCommand.lazy_subcommand('sc-param', _("Manipulate smart class parameters."),
|
103
|
+
'HammerCLIForeman::SmartClassParameter', 'hammer_cli_foreman/smart_class_parameter'
|
104
|
+
)
|
105
|
+
|
106
|
+
HammerCLI::MainCommand.lazy_subcommand('proxy', _("Manipulate smart proxies."),
|
107
|
+
'HammerCLIForeman::SmartProxy', 'hammer_cli_foreman/smart_proxy'
|
108
|
+
)
|
109
|
+
|
110
|
+
HammerCLI::MainCommand.lazy_subcommand('subnet', _("Manipulate subnets."),
|
111
|
+
'HammerCLIForeman::Subnet', 'hammer_cli_foreman/subnet'
|
112
|
+
)
|
113
|
+
|
114
|
+
HammerCLI::MainCommand.lazy_subcommand('template', _("Manipulate config templates."),
|
115
|
+
'HammerCLIForeman::Template', 'hammer_cli_foreman/template'
|
116
|
+
)
|
117
|
+
|
118
|
+
HammerCLI::MainCommand.lazy_subcommand('user', _("Manipulate users."),
|
119
|
+
'HammerCLIForeman::User', 'hammer_cli_foreman/user'
|
120
|
+
)
|
121
|
+
|
122
|
+
HammerCLI::MainCommand.lazy_subcommand('user-group', _("Manage user groups."),
|
123
|
+
'HammerCLIForeman::Usergroup', 'hammer_cli_foreman/usergroup'
|
124
|
+
)
|
125
|
+
|
49
126
|
|
50
127
|
rescue => e
|
51
128
|
handler = HammerCLIForeman::ExceptionHandler.new(:context => {}, :adapter => :base)
|
@@ -21,6 +21,7 @@ module HammerCLIForeman
|
|
21
21
|
base_command.const_set(name, cmd_cls)
|
22
22
|
|
23
23
|
cmd_cls.resource(base_command.resource.name)
|
24
|
+
cmd_cls.desc(command.desc)
|
24
25
|
#TODO: update messages to inherit from parents
|
25
26
|
cmd_cls.success_message(command.success_message)
|
26
27
|
cmd_cls.failure_message(command.failure_message)
|
@@ -37,10 +38,12 @@ module HammerCLIForeman
|
|
37
38
|
|
38
39
|
class AddHostgroupCommand < HammerCLIForeman::AddAssociatedCommand
|
39
40
|
associated_resource :hostgroups
|
41
|
+
desc _("Associate a hostgroup")
|
40
42
|
end
|
41
43
|
|
42
44
|
class RemoveHostgroupCommand < HammerCLIForeman::RemoveAssociatedCommand
|
43
45
|
associated_resource :hostgroups
|
46
|
+
desc _("Disassociate a hostgroup")
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
@@ -49,10 +52,12 @@ module HammerCLIForeman
|
|
49
52
|
|
50
53
|
class AddEnvironmentCommand < HammerCLIForeman::AddAssociatedCommand
|
51
54
|
associated_resource :environments
|
55
|
+
desc _("Associate an environment")
|
52
56
|
end
|
53
57
|
|
54
58
|
class RemoveEnvironmentCommand < HammerCLIForeman::RemoveAssociatedCommand
|
55
59
|
associated_resource :environments
|
60
|
+
desc _("Disassociate an environment")
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
@@ -61,10 +66,12 @@ module HammerCLIForeman
|
|
61
66
|
|
62
67
|
class AddDomainCommand < HammerCLIForeman::AddAssociatedCommand
|
63
68
|
associated_resource :domains
|
69
|
+
desc _("Associate a domain")
|
64
70
|
end
|
65
71
|
|
66
72
|
class RemoveDomainCommand < HammerCLIForeman::RemoveAssociatedCommand
|
67
73
|
associated_resource :domains
|
74
|
+
desc _("Disassociate a domain")
|
68
75
|
end
|
69
76
|
end
|
70
77
|
|
@@ -73,10 +80,12 @@ module HammerCLIForeman
|
|
73
80
|
|
74
81
|
class AddMediumCommand < HammerCLIForeman::AddAssociatedCommand
|
75
82
|
associated_resource :media
|
83
|
+
desc _("Associate a medium")
|
76
84
|
end
|
77
85
|
|
78
86
|
class RemoveMediumCommand < HammerCLIForeman::RemoveAssociatedCommand
|
79
87
|
associated_resource :media
|
88
|
+
desc _("Disassociate a medium")
|
80
89
|
end
|
81
90
|
end
|
82
91
|
|
@@ -85,10 +94,12 @@ module HammerCLIForeman
|
|
85
94
|
|
86
95
|
class AddSubnetCommand < HammerCLIForeman::AddAssociatedCommand
|
87
96
|
associated_resource :subnets
|
97
|
+
desc _("Associate a subnet")
|
88
98
|
end
|
89
99
|
|
90
100
|
class RemoveSubnetCommand < HammerCLIForeman::RemoveAssociatedCommand
|
91
101
|
associated_resource :subnets
|
102
|
+
desc _("Disassociate a subnet")
|
92
103
|
end
|
93
104
|
end
|
94
105
|
|
@@ -97,10 +108,12 @@ module HammerCLIForeman
|
|
97
108
|
|
98
109
|
class AddComputeResourceCommand < HammerCLIForeman::AddAssociatedCommand
|
99
110
|
associated_resource :compute_resources
|
111
|
+
desc _("Associate a compute resource")
|
100
112
|
end
|
101
113
|
|
102
114
|
class RemoveComputeResourceCommand < HammerCLIForeman::RemoveAssociatedCommand
|
103
115
|
associated_resource :compute_resources
|
116
|
+
desc _("Disassociate a compute resource")
|
104
117
|
end
|
105
118
|
end
|
106
119
|
|
@@ -109,6 +122,7 @@ module HammerCLIForeman
|
|
109
122
|
|
110
123
|
class AddSmartProxyCommand < HammerCLIForeman::AddAssociatedCommand
|
111
124
|
associated_resource :smart_proxies
|
125
|
+
desc _("Associate a smart proxy")
|
112
126
|
|
113
127
|
def associated_resource_name
|
114
128
|
"smart-proxy"
|
@@ -117,6 +131,7 @@ module HammerCLIForeman
|
|
117
131
|
|
118
132
|
class RemoveSmartProxyCommand < HammerCLIForeman::RemoveAssociatedCommand
|
119
133
|
associated_resource :smart_proxies
|
134
|
+
desc _("Disassociate a smart proxy")
|
120
135
|
|
121
136
|
def associated_resource_name
|
122
137
|
"smart-proxy"
|
@@ -129,6 +144,7 @@ module HammerCLIForeman
|
|
129
144
|
|
130
145
|
class AddUserCommand < HammerCLIForeman::AddAssociatedCommand
|
131
146
|
associated_resource :users
|
147
|
+
desc _("Associate an user")
|
132
148
|
|
133
149
|
success_message "The user has been associated"
|
134
150
|
failure_message "Could not associate the user"
|
@@ -136,21 +152,48 @@ module HammerCLIForeman
|
|
136
152
|
|
137
153
|
class RemoveUserCommand < HammerCLIForeman::RemoveAssociatedCommand
|
138
154
|
associated_resource :users
|
155
|
+
desc _("Disassociate an user")
|
139
156
|
|
140
157
|
success_message "The user has been disassociated"
|
141
158
|
failure_message "Could not disassociate the user"
|
142
159
|
end
|
143
160
|
end
|
144
161
|
|
162
|
+
module Usergroup
|
163
|
+
extend CommandExtension
|
164
|
+
|
165
|
+
class AddUsergroupCommand < HammerCLIForeman::AddAssociatedCommand
|
166
|
+
associated_resource :usergroups
|
167
|
+
desc _("Associate an user group")
|
168
|
+
|
169
|
+
command_name 'add-user-group'
|
170
|
+
|
171
|
+
success_message "The user group has been associated"
|
172
|
+
failure_message "Could not associate the user group"
|
173
|
+
end
|
174
|
+
|
175
|
+
class RemoveUsergroupCommand < HammerCLIForeman::RemoveAssociatedCommand
|
176
|
+
associated_resource :usergroups
|
177
|
+
desc _("Disassociate an user group")
|
178
|
+
|
179
|
+
command_name 'remove-user-group'
|
180
|
+
|
181
|
+
success_message "The user group has been disassociated"
|
182
|
+
failure_message "Could not disassociate the user group"
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
145
186
|
module ConfigTemplate
|
146
187
|
extend CommandExtension
|
147
188
|
|
148
189
|
class AddConfigTemplateCommand < HammerCLIForeman::AddAssociatedCommand
|
149
190
|
associated_resource :config_templates
|
191
|
+
desc _("Associate a configuration template")
|
150
192
|
end
|
151
193
|
|
152
194
|
class RemoveConfigTemplateCommand < HammerCLIForeman::RemoveAssociatedCommand
|
153
195
|
associated_resource :config_templates
|
196
|
+
desc _("Disassociate a configuration template")
|
154
197
|
end
|
155
198
|
end
|
156
199
|
|
@@ -159,10 +202,12 @@ module HammerCLIForeman
|
|
159
202
|
|
160
203
|
class AddOrganizationCommand < HammerCLIForeman::AddAssociatedCommand
|
161
204
|
associated_resource :organizations
|
205
|
+
desc _("Associate an organization")
|
162
206
|
end
|
163
207
|
|
164
208
|
class RemoveOrganizationCommand < HammerCLIForeman::RemoveAssociatedCommand
|
165
209
|
associated_resource :organizations
|
210
|
+
desc _("Disassociate an organization")
|
166
211
|
end
|
167
212
|
end
|
168
213
|
|
@@ -171,6 +216,7 @@ module HammerCLIForeman
|
|
171
216
|
|
172
217
|
class AddOSCommand < HammerCLIForeman::AddAssociatedCommand
|
173
218
|
associated_resource :operatingsystems
|
219
|
+
desc _("Associate an operating system")
|
174
220
|
|
175
221
|
success_message _("Operating system has been associated")
|
176
222
|
failure_message _("Could not associate the operating system")
|
@@ -179,6 +225,7 @@ module HammerCLIForeman
|
|
179
225
|
|
180
226
|
class RemoveOSCommand < HammerCLIForeman::RemoveAssociatedCommand
|
181
227
|
associated_resource :operatingsystems
|
228
|
+
desc _("Disassociate an operating system")
|
182
229
|
|
183
230
|
success_message _("Operating system has been disassociated")
|
184
231
|
failure_message _("Could not disassociate the operating system")
|
@@ -190,6 +237,7 @@ module HammerCLIForeman
|
|
190
237
|
|
191
238
|
class AddArchitectureCommand < HammerCLIForeman::AddAssociatedCommand
|
192
239
|
associated_resource :architectures
|
240
|
+
desc _("Associate an architecture")
|
193
241
|
|
194
242
|
success_message _("Architecture has been associated")
|
195
243
|
failure_message _("Could not associate the architecture")
|
@@ -198,6 +246,7 @@ module HammerCLIForeman
|
|
198
246
|
|
199
247
|
class RemoveArchitectureCommand < HammerCLIForeman::RemoveAssociatedCommand
|
200
248
|
associated_resource :architectures
|
249
|
+
desc _("Disassociate an architecture")
|
201
250
|
|
202
251
|
success_message _("Architecture has been disassociated")
|
203
252
|
failure_message _("Could not disassociate the architecture")
|
@@ -209,6 +258,7 @@ module HammerCLIForeman
|
|
209
258
|
|
210
259
|
class AddPartitionTableCommand < HammerCLIForeman::AddAssociatedCommand
|
211
260
|
associated_resource :ptables
|
261
|
+
desc _("Associate a partition table")
|
212
262
|
|
213
263
|
success_message _("Partition table has been associated")
|
214
264
|
failure_message _("Could not associate the partition table")
|
@@ -217,12 +267,33 @@ module HammerCLIForeman
|
|
217
267
|
|
218
268
|
class RemovePartitionTableCommand < HammerCLIForeman::RemoveAssociatedCommand
|
219
269
|
associated_resource :ptables
|
270
|
+
desc _("Disassociate a partition table")
|
220
271
|
|
221
272
|
success_message _("Partition table has been disassociated")
|
222
273
|
failure_message _("Could not disassociate the partition table")
|
223
274
|
end
|
224
275
|
end
|
225
276
|
|
277
|
+
module Role
|
278
|
+
extend CommandExtension
|
279
|
+
|
280
|
+
class AddRoleCommand < HammerCLIForeman::AddAssociatedCommand
|
281
|
+
associated_resource :roles
|
282
|
+
desc _("Assign a user role")
|
283
|
+
|
284
|
+
success_message _("User role has been assigned")
|
285
|
+
failure_message _("Could not assign the user role")
|
286
|
+
end
|
287
|
+
|
288
|
+
|
289
|
+
class RemoveRoleCommand < HammerCLIForeman::RemoveAssociatedCommand
|
290
|
+
associated_resource :roles
|
291
|
+
desc _("Remove a user role")
|
292
|
+
|
293
|
+
success_message _("User role has been removed")
|
294
|
+
failure_message _("Could not remove the user role")
|
295
|
+
end
|
296
|
+
end
|
226
297
|
|
227
298
|
end
|
228
299
|
end
|