hammer_cli_foreman_ansible 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54f34fccaaace9e4925e44f345a79c76f83e565c
4
- data.tar.gz: a774e12b53e96dadf57a7b4684499f186ed63463
3
+ metadata.gz: 711d672a9da9e9f53bbf6b0d80160b768227ac25
4
+ data.tar.gz: 99c0f69340edf77b5652a2e9713e7fadc2616b3b
5
5
  SHA512:
6
- metadata.gz: fe2db7999330e7d9068a91e24c1bdcc5288dd41d088c88d56df9082b40ea611a8b7f743c438078648e60d3731ed1b7c629e3b6fbb7018889e90917f4f5211c3d
7
- data.tar.gz: 71b47f1c798651bbb5fd8ca01b9f13a721c35958fe55b8da8abda0cea23ba814060a033563b282b6ea87676283bd64777acc5dd118ac87767a03ea4a2a163192
6
+ metadata.gz: 393c2f267071a0c52292c1e97364516ef959f961bbece4f3f6fe6299025de5c241082c16b3bed423e6c9ec8dca0e9fefc07577bae38fde6b417cd87c2fc7c982
7
+ data.tar.gz: b70e4e201aaf651e0aafedadb85a2b2191f50aad5ae3e13089a7fb06216ceb8f926519a5ef9099833e05739279e623154b64bdcd29148070a2c58f6eaa88387e
@@ -8,6 +8,13 @@ module HammerCLIForemanAnsible
8
8
  'hammer_cli_foreman_ansible/ansible_roles'
9
9
  )
10
10
 
11
+ lazy_subcommand(
12
+ 'variables',
13
+ _('Manage ansible variables'),
14
+ 'HammerCLIForemanAnsible::AnsibleVariablesCommand',
15
+ 'hammer_cli_foreman_ansible/ansible_variables'
16
+ )
17
+
11
18
  autoload_subcommands
12
19
  end
13
20
  end
@@ -19,7 +19,7 @@ module HammerCLIForemanAnsible
19
19
  build_options
20
20
  end
21
21
 
22
- class ChangedCommad < HammerCLIForeman::Command
22
+ class ChangedCommand < HammerCLIForeman::Command
23
23
  def execute
24
24
  response = {}
25
25
  response['changed'] = send_request
@@ -32,7 +32,7 @@ module HammerCLIForemanAnsible
32
32
  end
33
33
  end
34
34
 
35
- class ImportCommand < ChangedCommad
35
+ class ImportCommand < ChangedCommand
36
36
  action :import
37
37
  command_name 'import'
38
38
 
@@ -48,7 +48,7 @@ module HammerCLIForemanAnsible
48
48
  build_options
49
49
  end
50
50
 
51
- class ObsoleteCommand < ChangedCommad
51
+ class ObsoleteCommand < ChangedCommand
52
52
  action :obsolete
53
53
  command_name 'obsolete'
54
54
 
@@ -0,0 +1,119 @@
1
+ module HammerCLIForemanAnsible
2
+ class AnsibleVariablesCommand < HammerCLIForeman::Command
3
+ resource :ansible_variables
4
+
5
+ class ListCommand < HammerCLIForeman::ListCommand
6
+ output BaseAnsibleVariablesCommand.output_definition
7
+ build_options
8
+ end
9
+
10
+ class InfoCommand < HammerCLIForeman::InfoCommand
11
+ output AnsibleVariablesCommand::ListCommand.output_definition do
12
+ field :description, _("Description")
13
+ field :hidden_value?, _("Hidden Value?"), Fields::Boolean
14
+
15
+ label _("Validator") do
16
+ field :validator_type, _("Type")
17
+ field :validator_rule, _("Rule")
18
+ end
19
+ label _("Override values") do
20
+ field :merge_overrides, _("Merge overrides"), Fields::Boolean
21
+ field :merge_default, _("Merge default value"), Fields::Boolean
22
+ field :avoid_duplicates, _("Avoid duplicates"), Fields::Boolean
23
+ field :override_value_order, _("Order"), Fields::LongText
24
+ collection :override_values, _("Values") do
25
+ field :id, _('Id')
26
+ field :match, _('Match')
27
+ field :value, _('Value')
28
+ end
29
+ end
30
+
31
+ HammerCLIForeman::References.timestamps(self)
32
+ end
33
+ build_options
34
+ end
35
+
36
+ class DeleteCommand < HammerCLIForeman::DeleteCommand
37
+ success_message _('Ansible variable [%{variable}] was deleted.')
38
+ failure_message _('Could not delete the variable')
39
+
40
+ build_options
41
+ end
42
+
43
+ class UpdateCommand < HammerCLIForeman::UpdateCommand
44
+ success_message _("Ansible variable [%{variable}] updated.")
45
+ failure_message _("Could not update the ansible variable")
46
+
47
+ build_options
48
+ end
49
+
50
+ class ChangedCommand < HammerCLIForeman::Command
51
+ def execute
52
+ response = {}
53
+ response['changed'] = send_request
54
+ response['message'] = _('The following ansible variables were changed')
55
+ if response['changed'].empty?
56
+ response['message'] = _('No changes in ansible variables detected.')
57
+ end
58
+ print_data(response)
59
+ HammerCLI::EX_OK
60
+ end
61
+ end
62
+
63
+ class ImportCommand < ChangedCommand
64
+ action :import
65
+ command_name 'import'
66
+
67
+ failure_message _('Could not import variables')
68
+
69
+ output do
70
+ field :message, _('Result'), Fields::LongText
71
+ collection :changed, _('Imported'), hide_blank: true do
72
+ field :variable, nil
73
+ end
74
+ end
75
+
76
+ build_options
77
+ end
78
+
79
+ class ObsoleteCommand < ChangedCommand
80
+ action :obsolete
81
+ command_name 'obsolete'
82
+
83
+ failure_message _('Could not obsolete variables')
84
+
85
+ output do
86
+ field :message, _('Result'), Fields::LongText
87
+ collection :changed, _('Obsoleted'), hide_blank: true do
88
+ field :variable, nil
89
+ end
90
+ end
91
+
92
+ build_options
93
+ end
94
+
95
+ class AddMatcherCommand < HammerCLIForeman::CreateCommand
96
+ resource :ansible_override_values
97
+ command_name 'add-matcher'
98
+
99
+ option '--value', 'VALUE', _('Override value, required if omit is false')
100
+
101
+ success_message _("Override value created.")
102
+ failure_message _("Could not create the override value")
103
+
104
+ build_options
105
+ end
106
+
107
+ class RemoveMatcherCommand < HammerCLIForeman::DeleteCommand
108
+ resource :ansible_override_values
109
+ command_name 'remove-matcher'
110
+
111
+ success_message _("Override value deleted.")
112
+ failure_message _("Could not delete the override value")
113
+
114
+ build_options
115
+ end
116
+
117
+ autoload_subcommands
118
+ end
119
+ end
@@ -15,4 +15,26 @@ module HammerCLIForemanAnsible
15
15
  :table
16
16
  end
17
17
  end
18
+
19
+ class BaseAnsibleVariablesCommand < HammerCLIForeman::Command
20
+ command_name 'ansible-variables'
21
+ desc _('List all Ansible variables')
22
+
23
+ action :ansible_variables
24
+
25
+ output do
26
+ field :id, _('Id')
27
+
28
+ field :variable, _('Variable')
29
+ field :default_value, _('Default Value')
30
+ field :variable_type, _('Type')
31
+
32
+ field :ansible_role, _('Role')
33
+ field :ansible_role_id, _('Role Id'), Fields::Id
34
+ end
35
+
36
+ def adapter
37
+ :table
38
+ end
39
+ end
18
40
  end
@@ -1,3 +1,5 @@
1
1
  module HammerCLIForemanAnsible
2
- VERSION = '0.1.1'
2
+ def self.version
3
+ @version ||= Gem::Version.new '0.1.2'
4
+ end
3
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman_ansible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleh Fedorenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-04 00:00:00.000000000 Z
11
+ date: 2019-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hammer_cli_foreman
@@ -79,6 +79,7 @@ files:
79
79
  - lib/hammer_cli_foreman_ansible.rb
80
80
  - lib/hammer_cli_foreman_ansible/ansible.rb
81
81
  - lib/hammer_cli_foreman_ansible/ansible_roles.rb
82
+ - lib/hammer_cli_foreman_ansible/ansible_variables.rb
82
83
  - lib/hammer_cli_foreman_ansible/base.rb
83
84
  - lib/hammer_cli_foreman_ansible/host.rb
84
85
  - lib/hammer_cli_foreman_ansible/hostgroup.rb
@@ -105,7 +106,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
106
  version: '0'
106
107
  requirements: []
107
108
  rubyforge_project:
108
- rubygems_version: 2.6.14
109
+ rubygems_version: 2.6.8
109
110
  signing_key:
110
111
  specification_version: 4
111
112
  summary: Foreman Ansible plugin for Hammer CLI