hammer_cli_foreman_remote_execution 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bdb90815b99416e087efed5bf5901d8207aee6c9
4
- data.tar.gz: 28ac9b4a9e859af2fac1354ab87dcebf54d40601
3
+ metadata.gz: 668a26b604338f2325ffe7fa678ba91e074b7191
4
+ data.tar.gz: 91d012897fdaed83e57047dede6a404a50b14673
5
5
  SHA512:
6
- metadata.gz: 21ecf180e141ffbb370d15cbb1fb798fd25c3c5fb1a18a138f18da2b85e3339299cc55cf8da8faa79a42b66c9f3ff1009ffd7957b2831a603ca4287344f47874
7
- data.tar.gz: dac550144f0ecc605bf5d418274bbb5970d04803d185c08428fca862c9e562f1c7c46437392ad71b55a40fffb447bb62e11485b9996cd0f5a0cabdb5df813484
6
+ metadata.gz: b6ca4ef659fb3e336e63ff77e95a3c0f8e575fdc8a68377f295e702c3a929b130e36c8d7726ddcf52cc1e416467ca9807f1ef117a7151722154651ba1876e2bb
7
+ data.tar.gz: 8763f12279e5866092c58fc750c18bf0952f7b4d472b8e402d984b108388dcd4e8b2c951299b23ae827aba061ec23903ec930ef849e93087594bc6586514436a
data/.gitignore CHANGED
@@ -18,3 +18,7 @@ tags
18
18
  .idea
19
19
  *.sw?
20
20
  *~
21
+
22
+ # Locale files
23
+ locale/*/*.edit.po
24
+ locale/*/*.po.time_stamp
data/README.md CHANGED
@@ -8,41 +8,60 @@ CLI Plugin for Foreman Remote Execution
8
8
 
9
9
  This [Hammer CLI](https://github.com/theforeman/hammer-cli) plugin contains commands for [foreman_remote_execution](https://github.com/theforeman/foreman_remote_execution).
10
10
 
11
- Examples
12
- --------
11
+ # Examples
13
12
 
14
- ### Create a Template
13
+ ## Templates
14
+
15
+ ### List templates
16
+
17
+ ```
18
+ hammer job-template list
19
+ ```
20
+
21
+ ### Create a template
15
22
 
16
23
  ```
17
24
  hammer job-template create --file /tmp/template.txt --name "Ping a Host"\
18
- --provider-type Ssh --job-name "Ping"
25
+ --provider-type SSH --job-category "Commands"
19
26
  ```
20
27
 
21
- ### Create a Template Input
28
+ ### Create a template input
22
29
 
23
30
  ```
24
31
  hammer template-input create --template-id 17 --name hostname\
25
32
  --input-type user --options www.google.com,www.facebook.com,localhost
26
33
  ```
27
34
 
28
- ### Run a Job Examples
35
+ ## Jobs
36
+
37
+ ### Show jobs
38
+
39
+ ```
40
+ hammer job-invocation list
41
+ ```
42
+
43
+ Show details:
44
+
45
+ ```
46
+ hammer job-invocation info --id 83
47
+ ```
29
48
 
30
- #### Command line inputs
49
+ ### Run a job with command line inputs
31
50
 
32
51
  ```
33
- hammer job-invocation create --job-name "Run Command" --inputs command="ping -c 50 www.google.com"\
34
- --search-query "name ~ rex01"
52
+ hammer job-invocation create --job-template "Run Command - SSH Default" \
53
+ --inputs command="ping -c 50 www.google.com" --search-query "name ~ rex01"
35
54
  ```
36
55
 
37
56
  ```
38
- hammer job-invocation create --job-name "Package Action"\
57
+ hammer job-invocation create --job-template "Package Action - SSH Default" \
39
58
  --inputs package=vim-enhanced,action=install --search-query "name ~ rex01"
40
59
  ```
41
60
 
42
- #### File inputs:
61
+ ### Run a job with file inputs
43
62
 
44
63
  ```
45
- hammer job-invocation create --job-name "Run Command"\
64
+ hammer job-invocation create --job-template "Run Command - SSH Default"\
46
65
  --input-files command=/tmp/script.sh --search-query "name ~ rex01"
47
66
  ```
48
67
 
@@ -60,7 +79,6 @@ Alternatively, pass the `--async` option to see the output so far:
60
79
  hammer job-invocation output --id 155 --host rex01.example.com --async
61
80
  ```
62
81
 
63
- License
64
- -------
82
+ ## License
65
83
 
66
84
  This project is licensed under the GPLv3+.
data/Rakefile CHANGED
@@ -9,17 +9,28 @@ Rake::TestTask.new :test do |t|
9
9
  end
10
10
 
11
11
  namespace :gettext do
12
- desc 'Update pot file'
13
- task :find do
14
- require 'hammer_cli_foreman_remote_execution/version'
15
- require 'hammer_cli_foreman_remote_execution/i18n'
16
- require 'gettext/tools'
12
+
13
+ task :setup do
14
+ require "hammer_cli_foreman_remote_execution/version"
15
+ require "hammer_cli_foreman_remote_execution/i18n"
16
+ require 'gettext/tools/task'
17
17
 
18
18
  domain = HammerCLIForemanRemoteExecution::I18n::LocaleDomain.new
19
- GetText.update_pofiles(domain.domain_name, domain.translated_files,
20
- "#{domain.domain_name} #{HammerCLIForemanRemoteExecution.version}",
21
- :po_root => domain.locale_dir)
19
+ GetText::Tools::Task.define do |task|
20
+ task.package_name = domain.domain_name
21
+ task.package_version = HammerCLIForemanRemoteExecution.version.to_s
22
+ task.domain = domain.domain_name
23
+ task.mo_base_directory = domain.locale_dir
24
+ task.po_base_directory = domain.locale_dir
25
+ task.files = domain.translated_files
26
+ end
27
+ end
28
+
29
+ desc "Update pot file"
30
+ task :find => [:setup] do
31
+ Rake::Task["gettext:po:update"].invoke
22
32
  end
33
+
23
34
  end
24
35
 
25
36
  namespace :pkg do
@@ -8,6 +8,7 @@ module HammerCLIForemanRemoteExecution
8
8
  require 'hammer_cli_foreman_remote_execution/job_template'
9
9
  require 'hammer_cli_foreman_remote_execution/template_input'
10
10
  require 'hammer_cli_foreman_remote_execution/foreign_input_set'
11
+ require 'hammer_cli_foreman_remote_execution/remote_execution_feature'
11
12
 
12
13
  def self.exception_handler_class
13
14
  HammerCLIForeman::ExceptionHandler
@@ -5,8 +5,8 @@ module HammerCLIForemanRemoteExecution
5
5
 
6
6
  class ListCommand < HammerCLIForeman::ListCommand
7
7
  output do
8
- field :id, _('Id')
9
- field :target_template_id, _('Target template id')
8
+ field :id, _('ID')
9
+ field :target_template_id, _('Target template ID')
10
10
  field :target_template_name, _('Target template name')
11
11
  end
12
12
 
@@ -15,9 +15,9 @@ module HammerCLIForemanRemoteExecution
15
15
 
16
16
  class InfoCommand < HammerCLIForeman::InfoCommand
17
17
  output do
18
- field :id, _('Id')
18
+ field :id, _('ID')
19
19
  field :name, _('Name')
20
- field :target_template_id, _('Target template id')
20
+ field :target_template_id, _('Target template ID')
21
21
  field :target_template_name, _('Target template name')
22
22
  field :include_all, _('Include all')
23
23
  field :include, _('Include')
@@ -2,7 +2,9 @@ require 'hammer_cli/i18n'
2
2
 
3
3
  module HammerCLIForemanRemoteExecution
4
4
  module I18n
5
+
5
6
  class LocaleDomain < HammerCLI::I18n::LocaleDomain
7
+
6
8
  def translated_files
7
9
  Dir.glob(File.join(File.dirname(__FILE__), '../**/*.rb'))
8
10
  end
@@ -15,7 +17,17 @@ module HammerCLIForemanRemoteExecution
15
17
  'hammer-cli-foreman-remote-execution'
16
18
  end
17
19
  end
20
+
21
+ class SystemLocaleDomain < LocaleDomain
22
+
23
+ def locale_dir
24
+ '/usr/share/locale'
25
+ end
26
+
27
+ end
28
+
18
29
  end
19
30
  end
20
31
 
21
- HammerCLI::I18n.add_domain(HammerCLIForemanRemoteExecution::I18n::LocaleDomain.new)
32
+ domain = [HammerCLIForemanRemoteExecution::I18n::LocaleDomain.new, HammerCLIForemanRemoteExecution::I18n::SystemLocaleDomain.new].find { |d| d.available? }
33
+ HammerCLI::I18n.add_domain(domain) if domain
@@ -4,7 +4,7 @@ module HammerCLIForemanRemoteExecution
4
4
 
5
5
  class ListCommand < HammerCLIForeman::ListCommand
6
6
  output do
7
- field :id, _('Id')
7
+ field :id, _('ID')
8
8
  field :description, _('Description')
9
9
  field :status_label, _('Status')
10
10
  field :succeeded, _('Success')
@@ -4,7 +4,7 @@ module HammerCLIForemanRemoteExecution
4
4
 
5
5
  class ListCommand < HammerCLIForeman::ListCommand
6
6
  output do
7
- field :id, _('Id')
7
+ field :id, _('ID')
8
8
  field :name, _('Name')
9
9
  field :job_category, _('Job Category')
10
10
  field :provider_type, _('Provider')
@@ -0,0 +1,41 @@
1
+ module HammerCLIForemanRemoteExecution
2
+ class RemoteExecutionFeature < HammerCLIForeman::Command
3
+ resource :remote_execution_features
4
+ desc _('Manage remote execution features')
5
+
6
+ class ListCommand < HammerCLIForeman::ListCommand
7
+ output do
8
+ field :id, _('ID')
9
+ field :name, _('Name')
10
+ field :description, _('Description')
11
+ field :job_template_name, _('Job template name')
12
+ end
13
+
14
+ build_options
15
+ end
16
+
17
+ class InfoCommand < HammerCLIForeman::InfoCommand
18
+ output do
19
+ field :id, _('ID')
20
+ field :label, _('Label')
21
+ field :name, _('Name')
22
+ field :description, _('Description')
23
+ field :job_template_name, _('Job template name')
24
+ field :job_template_id, _('Job template ID')
25
+ end
26
+
27
+ build_options
28
+ end
29
+
30
+ class UpdateCommand < HammerCLIForeman::UpdateCommand
31
+ success_message _('Remote execution feature updated')
32
+ failure_message _('Could not update the remote execution feature')
33
+
34
+ build_options
35
+ end
36
+
37
+ autoload_subcommands
38
+ end
39
+
40
+ HammerCLI::MainCommand.subcommand 'remote-execution-feature', _('Manage remote execution features'), RemoteExecutionFeature
41
+ end
@@ -5,7 +5,7 @@ module HammerCLIForemanRemoteExecution
5
5
 
6
6
  class ListCommand < HammerCLIForeman::ListCommand
7
7
  output do
8
- field :id, _('Id')
8
+ field :id, _('ID')
9
9
  field :name, _('Name')
10
10
  field :input_type, _('Input type')
11
11
  end
@@ -15,7 +15,7 @@ module HammerCLIForemanRemoteExecution
15
15
 
16
16
  class InfoCommand < HammerCLIForeman::InfoCommand
17
17
  output do
18
- field :id, _('Id')
18
+ field :id, _('ID')
19
19
  field :name, _('Name')
20
20
  field :input_type, _('Input type')
21
21
 
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForemanRemoteExecution
2
2
  def self.version
3
- @version ||= Gem::Version.new '0.0.4'
3
+ @version ||= Gem::Version.new '0.0.5'
4
4
  end
5
5
  end
@@ -0,0 +1,57 @@
1
+ #
2
+ # Makefile for PO merging and MO generation. More info in the README.
3
+ #
4
+ # make all-mo (default) - generate MO files
5
+ # make check - check translations using translate-tool
6
+ # make tx-update - download and merge translations from Transifex
7
+ # make clean - clean everything
8
+ #
9
+ DOMAIN = hammer-cli-foreman-remote-execution
10
+ VERSION = $(shell ruby -e 'require "rubygems";spec = Gem::Specification::load("../hammer_cli_foreman_remote_execution.gemspec");puts spec.version')
11
+ POTFILE = $(DOMAIN).pot
12
+ MOFILE = $(DOMAIN).mo
13
+ POFILES = $(shell find . -name '$(DOMAIN).po')
14
+ MOFILES = $(patsubst %.po,%.mo,$(POFILES))
15
+ POXFILES = $(patsubst %.po,%.pox,$(POFILES))
16
+ EDITFILES = $(patsubst %.po,%.edit.po,$(POFILES))
17
+
18
+ %.mo: %.po
19
+ mkdir -p $(shell dirname $@)/LC_MESSAGES
20
+ msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $<
21
+
22
+ # Generate MO files from PO files
23
+ all-mo: $(MOFILES)
24
+
25
+ # Check for malformed strings
26
+ %.pox: %.po
27
+ msgfmt -c $<
28
+ pofilter --nofuzzy -t variables -t blank -t urls -t emails -t long -t newlines \
29
+ -t endwhitespace -t endpunc -t puncspacing -t options -t printf -t validchars --gnome $< > $@
30
+ cat $@
31
+ ! grep -q msgid $@
32
+
33
+ check: $(POXFILES)
34
+
35
+ # Unify duplicate translations
36
+ uniq-po:
37
+ for f in $(shell find ./ -name "*.po") ; do \
38
+ msguniq $$f -o $$f ; \
39
+ done
40
+
41
+ tx-pull: $(EDITFILES)
42
+ tx pull -f
43
+ for f in $(POFILES) ; do \
44
+ sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
45
+ done
46
+
47
+ # Extract strings and update the .pot, prepare .edit.po files
48
+ extract-strings:
49
+ bundle exec rake gettext:find
50
+
51
+ # Merge .edit.po into .po
52
+ update-po:
53
+ bundle exec rake gettext:find
54
+
55
+ tx-update: extract-strings tx-pull $(MOFILES)
56
+ git commit -m "i18n - extracting new, pulling from tx" ../locale
57
+ -echo Changes commited!
@@ -0,0 +1,18 @@
1
+ Updating the translations
2
+ -------------------------
3
+
4
+ 1. Check if there are any new languages with progress more than 50% on [transifex](https://www.transifex.com/projects/p/foreman/resource/hammer-cli-foreman/). If so, do the following for each of the new languages:
5
+
6
+ ```
7
+ mkdir locale/<lang>
8
+ cp locale/hammer-cli-foreman.pot locale/<lang>/hammer-cli-foreman.po
9
+ ```
10
+ 2. Make sure you have `transifex-client` installed
11
+
12
+ 3. Update the translations. From GIT repo root directory run:
13
+
14
+ ```
15
+ make -C locale tx-update
16
+ ```
17
+
18
+ It will download translations from transifex, generates `mo` files, updates strings in `pot` file and wraps all the changes in a new commit. Transifex automatically updates its strings when the commit is pushed to Github.
@@ -0,0 +1,209 @@
1
+ # English translations for hammer-cli-foreman-remote-execution package.
2
+ # Copyright (C) 2016 THE PACKAGE'S COPYRIGHT HOLDER
3
+ # This file is distributed under the same license as the hammer-cli-foreman-remote-execution package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, 2016.
5
+ #
6
+ msgid ""
7
+ msgstr ""
8
+ "Project-Id-Version: hammer-cli-foreman-remote-execution 0.0.4\n"
9
+ "Report-Msgid-Bugs-To: \n"
10
+ "PO-Revision-Date: 2016-02-10 14:04-0500\n"
11
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
12
+ "Language-Team: English\n"
13
+ "Language: en\n"
14
+ "MIME-Version: 1.0\n"
15
+ "Content-Type: text/plain; charset=UTF-8\n"
16
+ "Content-Transfer-Encoding: 8bit\n"
17
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
18
+ "\n"
19
+
20
+ msgid "Manage foreign input sets"
21
+ msgstr ""
22
+
23
+ msgid "ID"
24
+ msgstr ""
25
+
26
+ msgid "Target template ID"
27
+ msgstr ""
28
+
29
+ msgid "Target template name"
30
+ msgstr ""
31
+
32
+ msgid "Name"
33
+ msgstr ""
34
+
35
+ msgid "Include all"
36
+ msgstr ""
37
+
38
+ msgid "Include"
39
+ msgstr ""
40
+
41
+ msgid "Exclude"
42
+ msgstr ""
43
+
44
+ msgid "Foreign input set updated"
45
+ msgstr ""
46
+
47
+ msgid "Could not update the input set"
48
+ msgstr ""
49
+
50
+ msgid "Foreign input set created"
51
+ msgstr ""
52
+
53
+ msgid "Could not create the input set"
54
+ msgstr ""
55
+
56
+ msgid "Foreign input set deleted"
57
+ msgstr ""
58
+
59
+ msgid "Could not delete the input set"
60
+ msgstr ""
61
+
62
+ msgid "Description"
63
+ msgstr ""
64
+
65
+ msgid "Status"
66
+ msgstr ""
67
+
68
+ msgid "Success"
69
+ msgstr ""
70
+
71
+ msgid "Failed"
72
+ msgstr ""
73
+
74
+ msgid "Pending"
75
+ msgstr ""
76
+
77
+ msgid "Total"
78
+ msgstr ""
79
+
80
+ msgid "Start"
81
+ msgstr ""
82
+
83
+ msgid "Job Category"
84
+ msgstr ""
85
+
86
+ msgid "Mode"
87
+ msgstr ""
88
+
89
+ msgid "Cron line"
90
+ msgstr ""
91
+
92
+ msgid "Recurring logic ID"
93
+ msgstr ""
94
+
95
+ msgid "Hosts"
96
+ msgstr ""
97
+
98
+ msgid "View the output for a host"
99
+ msgstr ""
100
+
101
+ msgid "Do not wait for job to complete, shows current output only"
102
+ msgstr ""
103
+
104
+ msgid "Job invocation %{id} created"
105
+ msgstr ""
106
+
107
+ msgid "Schedule the execution for a later time"
108
+ msgstr ""
109
+
110
+ msgid "Execution should be cancelled if it cannot be started before --start-at"
111
+ msgstr ""
112
+
113
+ msgid "Create a recurring execution"
114
+ msgstr ""
115
+
116
+ msgid "Perform no more executions after this time, used with --cron-line"
117
+ msgstr ""
118
+
119
+ msgid "Specify inputs from command line"
120
+ msgstr ""
121
+
122
+ msgid "Read input values from files"
123
+ msgstr ""
124
+
125
+ msgid "Dynamic search queries are evaluated at run time"
126
+ msgstr ""
127
+
128
+ msgid "Manage job invocations"
129
+ msgstr ""
130
+
131
+ msgid "Provider"
132
+ msgstr ""
133
+
134
+ msgid "Type"
135
+ msgstr ""
136
+
137
+ msgid "Inputs"
138
+ msgstr ""
139
+
140
+ msgid "View job template content"
141
+ msgstr ""
142
+
143
+ msgid "Path to a file that contains the template"
144
+ msgstr ""
145
+
146
+ msgid "Job template created"
147
+ msgstr ""
148
+
149
+ msgid "Could not create the job template"
150
+ msgstr ""
151
+
152
+ msgid "Job template updated"
153
+ msgstr ""
154
+
155
+ msgid "Could not update the job template"
156
+ msgstr ""
157
+
158
+ msgid "Job template deleted"
159
+ msgstr ""
160
+
161
+ msgid "Could not delete the job template"
162
+ msgstr ""
163
+
164
+ msgid "Manage job templates"
165
+ msgstr ""
166
+
167
+ msgid ""
168
+ "Comma-separated list of key=file, where file is a path to a text file to be re"
169
+ "ad"
170
+ msgstr ""
171
+
172
+ msgid ""
173
+ "Cron line format 'a b c d e', where:\n"
174
+ " a. is minute (range: 0-59)\n"
175
+ " b. is hour (range: 0-23)\n"
176
+ " c. is day of month (range: 1-31)\n"
177
+ " d. is month (range: 1-12)\n"
178
+ " e. is day of week (range: 0-6)"
179
+ msgstr ""
180
+
181
+ msgid "Manage template inputs"
182
+ msgstr ""
183
+
184
+ msgid "Input type"
185
+ msgstr ""
186
+
187
+ msgid "Fact name"
188
+ msgstr ""
189
+
190
+ msgid "Variable name"
191
+ msgstr ""
192
+
193
+ msgid "Puppet parameter name"
194
+ msgstr ""
195
+
196
+ msgid "Options"
197
+ msgstr ""
198
+
199
+ msgid "Template input created"
200
+ msgstr ""
201
+
202
+ msgid "Could not create the template input"
203
+ msgstr ""
204
+
205
+ msgid "Template input deleted"
206
+ msgstr ""
207
+
208
+ msgid "Could not delete the template input"
209
+ msgstr ""