hammer_cli 3.11.0 → 3.12.0

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
  SHA256:
3
- metadata.gz: 28417298b7d1b18023350ab1f517ae82f6661b8883f9083fb767cc60aef2e95c
4
- data.tar.gz: 9e877483c4e92d62cfb1fca2b0913d75abed07ab0e5af0340240b61b5a583182
3
+ metadata.gz: '03459f5b492392bd38648599988ac3dd88ef9ed540b3234d7eef0e1140d99cce'
4
+ data.tar.gz: '08b41fb045c47eba7838eca2216df4153c35bb690acdfb63ff59a3566acbc5fb'
5
5
  SHA512:
6
- metadata.gz: 1999f20631b422871d571b2fa3fbeecc83c3220b319b092fbe201a0a6429ff478b189e427d2f4c736c08bac701304cce6673ddd999f91dfbecb636e080d4946f
7
- data.tar.gz: ad2058c279f4f5cc2c7160dde467017508fe288ee30277a322ee1a433cae698d4808150d769ca15760cb9d7842003fa053f99d7d4843a1ed097cbc49e726c174
6
+ metadata.gz: 363bfe3e6fbd7bc14910e61672856393789d800ea5ffbfe1a9d4c9f3abc003701c68f39d4282a97bd2732da800b4f48e6ff081e878f32b14e90656afe21aea7d
7
+ data.tar.gz: 4a55983e8ddaf65825875b0b115bd2994ccf5a7126e1a4ddc88a6270e0b4a985e5f0c688cbc907e1d6eadd07596362ad6799741c1a25cf35eecbcf53354a3da1
@@ -2,26 +2,29 @@
2
2
 
3
3
  #### Step 1: setup apt repositories
4
4
 
5
- For Foreman 1.3 stable the hammer packages are part of your installation repo and you can skip this step.
5
+ Since Foreman 1.3 the hammer packages are part of your installation repo.
6
+ It is only necessary to setup apt repositories if you are installing Hammer separatly from Foreman.
6
7
 
7
- You can choose from stable or nightly repo. Nightly has more recent version of hammer packages, but it was subject to less testing so there is a highr risk of issues.
8
+ You can choose from a specific version or nightly repo.
9
+ Nightly has more recent version of hammer packages that have only had limited testing so there is a higher risk of issues.
8
10
 
9
- Choose stable (don't forget to replace "squeeze" with version name of your system)
11
+ Here are a few examples for combinations of Linux-distributions and Foreman releases.
12
+ Remember to adjust these as necessary, visit http://deb.theforeman.org/ for up to date information.
10
13
 
11
- ```bash
12
- echo "deb http://deb.theforeman.org/ squeeze stable" > /etc/apt/sources.list.d/foreman.list
13
- ```
14
-
15
- or nightly
14
+ ##### Ubuntu Focal (20.04) with Foreman 3.10
16
15
 
17
16
  ```bash
18
- echo "deb http://deb.theforeman.org/ squeeze nightly" > /etc/apt/sources.list.d/foreman.list
17
+ mkdir -p /etc/apt/keyrings
18
+ wget -qO- https://deb.theforeman.org/foreman.asc > /etc/apt/keyrings/foreman.asc
19
+ echo "deb [signed-by=/etc/apt/keyrings/foreman.asc] http://deb.theforeman.org/ focal 3.10" > /etc/apt/sources.list.d/foreman.list
19
20
  ```
20
21
 
21
- and update the keys
22
+ ##### Debian Bullseye (11) with Foreman nightly
22
23
 
23
24
  ```bash
24
- wget -q https://deb.theforeman.org/foreman.asc -O- | apt-key add -
25
+ mkdir -p /etc/apt/keyrings
26
+ wget -qO- https://deb.theforeman.org/foreman.asc > /etc/apt/keyrings/foreman.asc
27
+ echo "deb [signed-by=/etc/apt/keyrings/foreman.asc] http://deb.theforeman.org/ bullseye nightly" > /etc/apt/sources.list.d/foreman.list
25
28
  ```
26
29
 
27
30
  #### Step 2: install hammer core
@@ -46,3 +49,4 @@ $ apt-get install ruby-hammer-cli-katello
46
49
  ```
47
50
 
48
51
  To install any other hammer plugin just make sure the appropriate gem is installed and follow with the [configuration](installation.md#configuration).
52
+
data/doc/release_notes.md CHANGED
@@ -1,5 +1,12 @@
1
1
  Release notes
2
2
  =============
3
+ ### 3.12.0 (2024-08-14)
4
+ * Log module loading warning to stderr ([PR #385](https://github.com/theforeman/hammer-cli/pull/385))
5
+ * Make clear_cache safe if no completion file is set ([PR #386](https://github.com/theforeman/hammer-cli/pull/386))
6
+ * Define correct timezone behavior in unittest, [#37579](http://projects.theforeman.org/issues/37579)
7
+ * Update deb install instructions ([PR #383](https://github.com/theforeman/hammer-cli/pull/383))
8
+ * Bump to 3.12.0-develop
9
+
3
10
  ### 3.11.0 (2024-05-22)
4
11
  * Bump to 3.11.0-develop
5
12
 
@@ -54,7 +54,7 @@ module HammerCLI
54
54
  require_module(name)
55
55
  rescue Exception => e
56
56
  logger.error "Error while loading module #{name}."
57
- puts _("Warning: An error occured while loading module %s.") % name
57
+ $stderr.puts _("Warning: An error occurred while loading module %s.") % name
58
58
  # with ModuleLoadingError we assume the error is already logged by the issuer
59
59
  logger.error e unless e.is_a?(HammerCLI::ModuleLoadingError)
60
60
  raise e
@@ -55,8 +55,9 @@ module HammerCLI
55
55
  end
56
56
 
57
57
  def self.clear_cache
58
- cache_file = File.expand_path(HammerCLI::Settings.get(:completion_cache_file))
59
- File.delete(cache_file) if File.exist?(cache_file)
58
+ if (completion_file = HammerCLI::Settings.get(:completion_cache_file))
59
+ FileUtils.rm_f(File.expand_path(completion_file))
60
+ end
60
61
  end
61
62
 
62
63
  def self.interactive?
@@ -1,5 +1,5 @@
1
1
  module HammerCLI
2
2
  def self.version
3
- @version ||= Gem::Version.new "3.11.0"
3
+ @version ||= Gem::Version.new "3.12.0"
4
4
  end
5
5
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -128,26 +128,25 @@ describe HammerCLI::Modules do
128
128
  before :each do
129
129
  HammerCLI::Modules.stubs(:require_module).raises(RuntimeError)
130
130
  @error_msg = "ERROR Modules : Error while loading module hammer_cli_tom."
131
- @warning_msg = "Warning: An error occured while loading module hammer_cli_tom."
131
+ @warning_msg = "Warning: An error occurred while loading module hammer_cli_tom."
132
132
  end
133
133
 
134
134
  it "must log an error if the load! fails" do
135
- out, _ = capture_io do
135
+ assert_output("", "#{@warning_msg}\n") do
136
136
  assert_raises(RuntimeError) { HammerCLI::Modules.load!('hammer_cli_tom') }
137
137
  end
138
- _(out).must_equal "#{@warning_msg}\n"
139
138
  _(@log_output.readline.strip).must_equal @error_msg
140
139
  end
141
140
 
142
141
  it "must log an error if the load fails" do
143
- assert_output("#{@warning_msg}\n", "") do
142
+ assert_output("", "#{@warning_msg}\n") do
144
143
  HammerCLI::Modules.load("hammer_cli_tom")
145
144
  end
146
145
  _(@log_output.readline.strip).must_equal @error_msg
147
146
  end
148
147
 
149
148
  it "must return false when load fails" do
150
- assert_output("#{@warning_msg}\n", "") do
149
+ assert_output("", "#{@warning_msg}\n") do
151
150
  _(HammerCLI::Modules.load("hammer_cli_tom")).must_equal false
152
151
  end
153
152
  end
@@ -416,6 +416,16 @@ describe HammerCLI::Options::Normalizers do
416
416
 
417
417
  end
418
418
 
419
+ def mock_env(partial_env_hash)
420
+ old_env = ENV.to_hash
421
+ ENV.update partial_env_hash
422
+ begin
423
+ yield
424
+ ensure
425
+ ENV.replace old_env
426
+ end
427
+ end
428
+
419
429
  describe 'datetime' do
420
430
 
421
431
  let(:formatter) { HammerCLI::Options::Normalizers::DateTime.new }
@@ -429,15 +439,45 @@ describe HammerCLI::Options::Normalizers do
429
439
  end
430
440
 
431
441
  it "should accept and parse iso8601" do
432
- _(formatter.format("1986-01-01T08:30:20")).must_equal("1986-01-01T08:30:20+00:00")
442
+ mock_env("TZ" => "UTC") do
443
+ _(formatter.format("1986-01-01T08:30:20")).must_equal("1986-01-01T08:30:20+00:00")
444
+ end
433
445
  end
434
446
 
435
447
  it "should accept and parse YYYY-MM-DD HH:MM:SS" do
436
- _(formatter.format("1986-01-01 08:30:20")).must_equal("1986-01-01T08:30:20+00:00")
448
+ mock_env("TZ" => "UTC") do
449
+ _(formatter.format("1986-01-01 08:30:20")).must_equal("1986-01-01T08:30:20+00:00")
450
+ end
437
451
  end
438
452
 
439
453
  it "should accept and parse YYYY/MM/DD HH:MM:SS" do
440
- _(formatter.format("1986/01/01 08:30:20")).must_equal("1986-01-01T08:30:20+00:00")
454
+ mock_env("TZ" => "UTC") do
455
+ _(formatter.format("1986/01/01 08:30:20")).must_equal("1986-01-01T08:30:20+00:00")
456
+ end
457
+ end
458
+
459
+ it "should parse iso8601 compliant timezones" do
460
+ mock_env("TZ" => "UTC") do
461
+ _(formatter.format("1986-01-01 08:30:20 +04:00")).must_equal("1986-01-01T08:30:20+04:00")
462
+ end
463
+ end
464
+
465
+ it "should not parse non iso8601 formatted timezones" do
466
+ mock_env("TZ" => "Asia/Tokyo") do
467
+ _(formatter.format("1986-01-01 08:30:20 foo")).must_equal("1986-01-01T08:30:20+09:00")
468
+ end
469
+ end
470
+
471
+ it "should use system provided timezone" do
472
+ mock_env("TZ" => "Asia/Tokyo") do
473
+ _(formatter.format("1986-01-01 08:30:20")).must_equal("1986-01-01T08:30:20+09:00")
474
+ end
475
+ end
476
+
477
+ it "should overwrite default timezone" do
478
+ mock_env("TZ" => "Asia/Tokyo") do
479
+ _(formatter.format("1986-01-01 08:30:20 +04:00")).must_equal("1986-01-01T08:30:20+04:00")
480
+ end
441
481
  end
442
482
 
443
483
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.11.0
4
+ version: 3.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Bačovský
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-05-22 00:00:00.000000000 Z
12
+ date: 2024-08-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp