hammer_cli_foreman 0.1.3 → 0.1.4
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/doc/release_notes.md +18 -0
- data/lib/hammer_cli_foreman.rb +4 -0
- data/lib/hammer_cli_foreman/auth_source.rb +10 -0
- data/lib/hammer_cli_foreman/auth_source_ldap.rb +70 -0
- data/lib/hammer_cli_foreman/commands.rb +47 -3
- data/lib/hammer_cli_foreman/credentials.rb +35 -4
- data/lib/hammer_cli_foreman/exceptions.rb +10 -1
- data/lib/hammer_cli_foreman/external_usergroup.rb +83 -0
- data/lib/hammer_cli_foreman/host.rb +26 -22
- data/lib/hammer_cli_foreman/hostgroup.rb +12 -5
- data/lib/hammer_cli_foreman/i18n.rb +4 -0
- data/lib/hammer_cli_foreman/id_resolver.rb +81 -13
- data/lib/hammer_cli_foreman/operating_system.rb +5 -44
- data/lib/hammer_cli_foreman/option_builders.rb +64 -5
- data/lib/hammer_cli_foreman/organization.rb +3 -3
- data/lib/hammer_cli_foreman/param_filters.rb +18 -2
- data/lib/hammer_cli_foreman/references.rb +9 -1
- data/lib/hammer_cli_foreman/role.rb +2 -5
- data/lib/hammer_cli_foreman/usergroup.rb +4 -0
- data/lib/hammer_cli_foreman/version.rb +1 -1
- data/locale/de/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/de/hammer-cli-foreman.po +2169 -0
- data/locale/en/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en/hammer-cli-foreman.po +1 -1
- data/locale/en_GB/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/en_GB/hammer-cli-foreman.po +254 -81
- data/locale/es/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/es/hammer-cli-foreman.po +268 -94
- data/locale/fr/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/fr/hammer-cli-foreman.po +258 -84
- data/locale/hammer-cli-foreman.pot +428 -321
- data/locale/it/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/it/hammer-cli-foreman.po +2168 -0
- data/locale/ja/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ja/hammer-cli-foreman.po +2167 -0
- data/locale/ko/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ko/hammer-cli-foreman.po +2167 -0
- data/locale/pt_BR/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/pt_BR/hammer-cli-foreman.po +2167 -0
- data/locale/ru/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/ru/hammer-cli-foreman.po +2166 -0
- data/locale/zh_CN/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_CN/hammer-cli-foreman.po +2166 -0
- data/locale/zh_TW/LC_MESSAGES/hammer-cli-foreman.mo +0 -0
- data/locale/zh_TW/hammer-cli-foreman.po +2166 -0
- data/test/unit/auth_source_ldap_test.rb +95 -0
- data/test/unit/credentials_test.rb +20 -7
- data/test/unit/data/1.6/foreman_api.json +1 -1
- data/test/unit/data/1.6/foreman_api_back.json +1 -0
- data/test/unit/data/1.6/whatever.json +1 -0
- data/test/unit/external_usergroup_test.rb +103 -0
- data/test/unit/helpers/command.rb +5 -1
- data/test/unit/host_test.rb +4 -4
- data/test/unit/hostgroup_test.rb +5 -5
- data/test/unit/media_test.rb +2 -2
- data/test/unit/operating_system_test.rb +7 -1
- data/test/unit/param_filters_test.rb +65 -0
- data/test/unit/smart_class_parameter_test.rb +1 -1
- metadata +335 -309
- data/lib/hammer_cli_foreman/smart_variables.rb +0 -111
@@ -1,111 +0,0 @@
|
|
1
|
-
module HammerCLIForeman
|
2
|
-
|
3
|
-
class SmartVariableBriefList < HammerCLIForeman::AssociatedResourceListCommand
|
4
|
-
resource :smart_variables, :index
|
5
|
-
|
6
|
-
output do
|
7
|
-
field :id, _("Id")
|
8
|
-
|
9
|
-
field :parameter, _("Parameter")
|
10
|
-
field :default_value, _("Default Value")
|
11
|
-
field :override, _("Override")
|
12
|
-
end
|
13
|
-
|
14
|
-
def send_request
|
15
|
-
res = super
|
16
|
-
# FIXME: API returns doubled records, probably just if filtered by puppetclasses
|
17
|
-
# it seems group by environment is missing
|
18
|
-
# having the uniq to fix that
|
19
|
-
HammerCLI::Output::RecordCollection.new(res.uniq, :meta => res.meta)
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.build_options(options={})
|
23
|
-
options[:without] ||= [:host_id, :hostgroup_id, :puppetclass_id, :environment_id]
|
24
|
-
super(options)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
class SmartVariableList < SmartVariableBriefList
|
29
|
-
|
30
|
-
output do
|
31
|
-
from :puppetclass do
|
32
|
-
field :name, _("Puppet class")
|
33
|
-
field :id, _("Class Id"), Fields::Id
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
class SmartVariable < HammerCLIForeman::Command
|
39
|
-
|
40
|
-
resource :smart_variables
|
41
|
-
|
42
|
-
class ListCommand < HammerCLIForeman::ListCommand
|
43
|
-
|
44
|
-
output SmartVariablesList.output_definition
|
45
|
-
|
46
|
-
build_options
|
47
|
-
end
|
48
|
-
|
49
|
-
class InfoCommand < HammerCLIForeman::InfoCommand
|
50
|
-
|
51
|
-
output ListCommand.output_definition do
|
52
|
-
field :description, _("Description")
|
53
|
-
field :parameter_type, _("Type")
|
54
|
-
field :required, _("Required")
|
55
|
-
|
56
|
-
label _("Validator") do
|
57
|
-
field :validator_type, _("Type")
|
58
|
-
field :validator_rule, _("Rule")
|
59
|
-
end
|
60
|
-
label _("Override values") do
|
61
|
-
field :override_value_order, _("Order"), Fields::List
|
62
|
-
field :override_values_count, _("Count")
|
63
|
-
collection :override_values, "Values" do
|
64
|
-
label _("Value") do
|
65
|
-
field :id, _('Id')
|
66
|
-
field :match, _('Match')
|
67
|
-
field :value, _('Value')
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
HammerCLIForeman::References.environments(self)
|
72
|
-
HammerCLIForeman::References.timestamps(self)
|
73
|
-
end
|
74
|
-
|
75
|
-
def extend_data(res)
|
76
|
-
res['override_value_order'] = res['override_value_order'].split("\n")
|
77
|
-
res
|
78
|
-
end
|
79
|
-
|
80
|
-
build_options
|
81
|
-
end
|
82
|
-
|
83
|
-
class UpdateCommand < HammerCLIForeman::UpdateCommand
|
84
|
-
|
85
|
-
success_message _("Parameter updated")
|
86
|
-
failure_message _("Could not update the parameter")
|
87
|
-
|
88
|
-
build_options :without => [:parameter_type, :validator_type, :override, :required]
|
89
|
-
|
90
|
-
option "--override", "OVERRIDE", _("Override this parameter."),
|
91
|
-
:format => HammerCLI::Options::Normalizers::Bool.new
|
92
|
-
option "--required", "REQUIRED", _("This parameter is required."),
|
93
|
-
:format => HammerCLI::Options::Normalizers::Bool.new
|
94
|
-
option "--parameter-type", "PARAMETER_TYPE", _("Type of the parameter."),
|
95
|
-
:format => HammerCLI::Options::Normalizers::Enum.new(
|
96
|
-
['string', 'boolean', 'integer', 'real', 'array', 'hash', 'yaml', 'json'])
|
97
|
-
option "--validator-type", "VALIDATOR_TYPE", _("Type of the validator."),
|
98
|
-
:format => HammerCLI::Options::Normalizers::Enum.new(['regexp', 'list', ''])
|
99
|
-
end
|
100
|
-
|
101
|
-
class AddOverrideValueCommand < HammerCLIForeman::UpdateCommand
|
102
|
-
|
103
|
-
end
|
104
|
-
|
105
|
-
autoload_subcommands
|
106
|
-
|
107
|
-
end
|
108
|
-
|
109
|
-
HammerCLI::MainCommand.subcommand 'smart-variable', _("Manipulate smart variables."), HammerCLIForeman::SmartVariable
|
110
|
-
|
111
|
-
end
|