hammer_cli_foreman 0.13.1 → 0.13.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: 2caf9087105bdd00ac37c6968833a5ad163710f2
4
- data.tar.gz: '00296238bf77e4bcf9d11a080e589176ebae6df2'
3
+ metadata.gz: 299ecfde2e76d65fc4c7f1d5bdac72f5d51143b0
4
+ data.tar.gz: 9b103faecf764289ef13d92c5eed3b2d2080cca6
5
5
  SHA512:
6
- metadata.gz: d97d63f32e7677044e2a8585bb626c1364173671ea20c5c1293418649878902ed2156ff283afcba688a3b16e4218f54cec420fd143335aaec5f6d6e45ea781fe
7
- data.tar.gz: ff428a43ca9f2b51ff59e5fef8863d78baba307c07ed8ca5fa87ac9f212ffa3a4114c589ca2b2c6664d6cdf325c77f5598f0bb6f18cfd50d076ab3866301de2e
6
+ metadata.gz: 0e1c8af02919b59b4650ab43a2435af314b9c52371eb4c258015e2e06a61a0e3786d30a49fc54ca7e9b0738160c8a3f94d05b43d7077c84b76dd3d129bf57c49
7
+ data.tar.gz: 942d83cbaf1b5d836ac3fc1cdfb8f6a37b52ea8695d8dbc49dfacbf86725c148e3c4b48b308f98bc1940901cd7dc7c68414091bc0141f857bd977d36fd7d78a4
@@ -1,5 +1,9 @@
1
1
  Release notes
2
2
  =============
3
+ ### 0.13.2 (2018-08-15)
4
+ * Stop overriding apipie help for host flags ([#24490](http://projects.theforeman.org/issues/24490))
5
+ * Hammer asks for user password though -p option provided ([#23996](http://projects.theforeman.org/issues/23996))
6
+
3
7
  ### 0.13.1 (2018-07-18)
4
8
  * removed redundant info about OS from hostgroup ([#23722](http://projects.theforeman.org/issues/23722))
5
9
 
@@ -30,6 +30,10 @@ module HammerCLIForeman
30
30
  @user ||= ask && get_user
31
31
  end
32
32
 
33
+ def password(ask=nil)
34
+ @password ||= ask && get_password
35
+ end
36
+
33
37
  def set_credentials(user, password)
34
38
  @user = user
35
39
  @password = password
@@ -82,6 +82,10 @@ module HammerCLIForeman
82
82
  @authenticator.user(ask) if @authenticator.respond_to?(:user)
83
83
  end
84
84
 
85
+ def password(ask=nil)
86
+ @authenticator.password(ask) if @authenticator.respond_to?(:password)
87
+ end
88
+
85
89
  def set_credentials(*args)
86
90
  @authenticator.set_credentials(*args) if @authenticator.respond_to?(:set_credentials)
87
91
  end
@@ -25,12 +25,6 @@ module HammerCLIForeman
25
25
  bme_options = {}
26
26
  bme_options[:default] = 'true' if base.action.to_sym == :create
27
27
 
28
- bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
29
- base.option "--managed", "MANAGED", " ", bme_options
30
- bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
31
- base.option "--build", "BUILD", " ", bme_options
32
- bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
33
- base.option "--enabled", "ENABLED", " ", bme_options
34
28
  bme_options[:format] = HammerCLI::Options::Normalizers::Bool.new
35
29
  base.option "--overwrite", "OVERWRITE", " ", bme_options
36
30
 
@@ -71,9 +65,11 @@ module HammerCLIForeman
71
65
  puppetclass_ids = option_puppetclass_ids || puppet_class_ids(option_puppet_classes)
72
66
  params['host']['puppetclass_ids'] = puppetclass_ids unless puppetclass_ids.nil?
73
67
 
74
- params['host']['build'] = option_build unless option_build.nil?
75
- params['host']['managed'] = option_managed unless option_managed.nil?
76
- params['host']['enabled'] = option_enabled unless option_enabled.nil?
68
+ if action == :create
69
+ params['host']['build'] = true if option_build.nil?
70
+ params['host']['managed'] = true if option_managed.nil?
71
+ params['host']['enabled'] = true if option_enabled.nil?
72
+ end
77
73
  params['host']['overwrite'] = option_overwrite unless option_overwrite.nil?
78
74
 
79
75
  params['host']['host_parameters_attributes'] = parameter_attributes
@@ -13,7 +13,10 @@ module HammerCLIForeman
13
13
 
14
14
  if @command.action == :update
15
15
  if result[option_name(:password)] || result[option_name(:ask_password)]
16
+
16
17
  if current_logged_user["id"].to_s == result[option_name(:id)].to_s
18
+ curr_passwd = HammerCLIForeman.foreman_api_connection.authenticator.password(true)
19
+ result[option_name(:current_password)] = curr_passwd unless curr_passwd.nil?
17
20
  unless result[option_name(:current_password)]
18
21
  result[option_name(:current_password)] = ask_password(:current)
19
22
  end
@@ -1,5 +1,5 @@
1
1
  module HammerCLIForeman
2
2
  def self.version
3
- @version ||= Gem::Version.new '0.13.1'
3
+ @version ||= Gem::Version.new '0.13.2'
4
4
  end
5
5
  end
@@ -66,6 +66,20 @@ describe HammerCLIForeman::Api::InteractiveBasicAuth do
66
66
  end
67
67
  end
68
68
 
69
+ describe '#password' do
70
+ it "returns nil when password wasn't provided" do
71
+ auth = HammerCLIForeman::Api::InteractiveBasicAuth.new(nil, nil)
72
+
73
+ assert_nil auth.password
74
+ end
75
+
76
+ it "returns the password" do
77
+ auth = HammerCLIForeman::Api::InteractiveBasicAuth.new(nil, 'testpswd')
78
+
79
+ assert_equal 'testpswd', auth.password
80
+ end
81
+ end
82
+
69
83
  describe '#error' do
70
84
  let(:auth) { HammerCLIForeman::Api::InteractiveBasicAuth.new(nil, nil) }
71
85
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hammer_cli_foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.1
4
+ version: 0.13.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomáš Strachota
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-07-16 00:00:00.000000000 Z
12
+ date: 2018-08-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hammer_cli