mcollective-client 2.8.9 → 2.9.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
  SHA1:
3
- metadata.gz: 67b38bbfce7f0aba03c8178a28501d99894e3d2f
4
- data.tar.gz: 657509db5b28a31967dfd16fc333da90c12eb605
3
+ metadata.gz: 65208c5aeb53a535cdcbf8d633f4bcb538c70f59
4
+ data.tar.gz: a7b6501a7b73dae8201d34e3d64275b5a184d369
5
5
  SHA512:
6
- metadata.gz: f70b87a2142b39da0f78d9096b75f6a4177cefcc26cd15a42779973dcf6823a78ce7aa035431938c1bb93711ce0430f4eda062e771bb438e790f5c3b32d54e3b
7
- data.tar.gz: 671f207d9cddb69f948499413c2867719a919252cf054af3fcb65e91b741fee6de75498be1900a49fc453cd2ef294da0ef34365a2c86eb554973c051efde5813
6
+ metadata.gz: 4473732cda0184dee2c04226516018fb28c41427d1bbd65426eb3ceea26c3337f9a7ad3799cc15d8f3eb335fab2e98f06b7ac6d9393e2aebf875ef5ad7569636
7
+ data.tar.gz: 6de6f9e59d3c284dcc3543a96843257a5230e1eace03ca21e87ea246f1540c86abe8bc7e6ebe97fb98675c5c15671bc07ca1fb61895029c7783a9f82881d9cea
data/lib/mcollective.rb CHANGED
@@ -59,7 +59,7 @@ module MCollective
59
59
 
60
60
  MCollective::Vendor.load_vendored
61
61
 
62
- VERSION="2.8.9"
62
+ VERSION="2.9.0"
63
63
 
64
64
  def self.version
65
65
  VERSION
@@ -224,15 +224,43 @@ module MCollective
224
224
 
225
225
  pools = Integer(get_option("activemq.pool.size"))
226
226
  hosts = []
227
+ middleware_user = ''
228
+ middleware_password = ''
229
+ prompt_for_username = get_bool_option("activemq.prompt_user", "false")
230
+ prompt_for_password = get_bool_option("activemq.prompt_password", "false")
231
+
232
+ if prompt_for_username
233
+ Log.debug("No previous user exists and activemq.prompt-user is set to true")
234
+ print "Please enter user to connect to middleware: "
235
+ middleware_user = STDIN.gets.chomp
236
+ end
237
+
238
+ if prompt_for_password
239
+ Log.debug("No previous password exists and activemq.prompt-password is set to true")
240
+ middleware_password = MCollective::Util.get_hidden_input("Please enter password: ")
241
+ print "\n"
242
+ end
227
243
 
228
244
  1.upto(pools) do |poolnum|
229
245
  host = {}
230
246
 
231
247
  host[:host] = get_option("activemq.pool.#{poolnum}.host")
232
248
  host[:port] = get_option("activemq.pool.#{poolnum}.port", 61613).to_i
233
- host[:login] = get_env_or_option("STOMP_USER", "activemq.pool.#{poolnum}.user", '')
234
- host[:passcode] = get_env_or_option("STOMP_PASSWORD", "activemq.pool.#{poolnum}.password", '')
235
249
  host[:ssl] = get_bool_option("activemq.pool.#{poolnum}.ssl", "false")
250
+
251
+ # read user from config file
252
+ host[:login] = get_env_or_option("STOMP_USER", "activemq.pool.#{poolnum}.user", middleware_user)
253
+ if prompt_for_username and host[:login] != middleware_user
254
+ Log.info("Using #{host[:login]} from config file to connect to #{host[:host]}. "+
255
+ "plugin.activemq.prompt_user should be set to false to remove the prompt.")
256
+ end
257
+
258
+ # read user from config file
259
+ host[:passcode] = get_env_or_option("STOMP_PASSWORD", "activemq.pool.#{poolnum}.password", middleware_password)
260
+ if prompt_for_password and host[:passcode] != middleware_password
261
+ Log.info("Using password from config file to connect to #{host[:host]}. "+
262
+ "plugin.activemq.prompt_password should be set to false to remove the prompt.")
263
+ end
236
264
 
237
265
  # if ssl is enabled set :ssl to the hash of parameters
238
266
  if host[:ssl]
@@ -118,16 +118,43 @@ module MCollective
118
118
 
119
119
  pools = Integer(get_option("rabbitmq.pool.size"))
120
120
  hosts = []
121
+ middleware_user = ''
122
+ middleware_password = ''
123
+ prompt_for_username = get_bool_option("rabbitmq.prompt_user", "false")
124
+ prompt_for_password = get_bool_option("rabbitmq.prompt_password", "false")
125
+ if prompt_for_username
126
+ Log.debug("No previous user exists and rabbitmq.prompt-user is set to true")
127
+ print "Please enter user to connect to middleware: "
128
+ middleware_user = STDIN.gets.chomp
129
+ end
121
130
 
131
+ if prompt_for_password
132
+ Log.debug("No previous password exists and rabbitmq.prompt-password is set to true")
133
+ middleware_password = MCollective::Util.get_hidden_input("Please enter password: ")
134
+ print "\n"
135
+ end
136
+
122
137
  1.upto(pools) do |poolnum|
123
138
  host = {}
124
139
 
125
140
  host[:host] = get_option("rabbitmq.pool.#{poolnum}.host")
126
141
  host[:port] = get_option("rabbitmq.pool.#{poolnum}.port", 61613).to_i
127
- host[:login] = get_env_or_option("STOMP_USER", "rabbitmq.pool.#{poolnum}.user", '')
128
- host[:passcode] = get_env_or_option("STOMP_PASSWORD", "rabbitmq.pool.#{poolnum}.password", '')
129
142
  host[:ssl] = get_bool_option("rabbitmq.pool.#{poolnum}.ssl", "false")
130
-
143
+
144
+ # read user from config file
145
+ host[:login] = get_env_or_option("STOMP_USER", "rabbitmq.pool.#{poolnum}.user", middleware_user)
146
+ if prompt_for_username and host[:login] != middleware_user
147
+ Log.info("Using #{host[:login]} from config file to connect to #{host[:host]}. "+
148
+ "plugin.rabbitmq.prompt_user should be set to false to remove the prompt.")
149
+ end
150
+
151
+ # read password from config file
152
+ host[:passcode] = get_env_or_option("STOMP_PASSWORD", "rabbitmq.pool.#{poolnum}.password", middleware_password)
153
+ if prompt_for_password and host[:passcode] != middleware_password
154
+ Log.info("Using password from config file to connect to #{host[:host]}. "+
155
+ "plugin.rabbitmq.prompt_password should be set to false to remove the prompt.")
156
+ end
157
+
131
158
  # if ssl is enabled set :ssl to the hash of parameters
132
159
  if host[:ssl]
133
160
  host[:ssl] = ssl_parameters(poolnum, get_bool_option("rabbitmq.pool.#{poolnum}.ssl.fallback", "false"))
@@ -91,11 +91,11 @@ module MCollective
91
91
  dependencies = []
92
92
  PluginPackager.filter_dependencies('debian', data[:dependencies]).each do |dep|
93
93
  if dep[:version] && dep[:revision]
94
- dependencies << "#{dep[:name]} (>=#{dep[:version]}-#{dep[:revision]})"
94
+ dependencies << "#{dep[:name]} (>=#{dep[:version]}-#{dep[:revision]}) | puppet-agent"
95
95
  elsif dep[:version]
96
- dependencies << "#{dep[:name]} (>=#{dep[:version]})"
96
+ dependencies << "#{dep[:name]} (>=#{dep[:version]}) | puppet-agent"
97
97
  else
98
- dependencies << dep[:name]
98
+ dependencies << "#{dep[:name]} | puppet-agent"
99
99
  end
100
100
  end
101
101
 
@@ -520,5 +520,60 @@ module MCollective
520
520
  number = (max_size/field_size).to_i
521
521
  (number == 0) ? 1 : number
522
522
  end
523
+
524
+ def self.get_hidden_input_on_windows()
525
+ require 'Win32API'
526
+ # Hook into getch from crtdll. Keep reading all keys till return
527
+ # or newline is hit.
528
+ # If key is backspace or delete, then delete the character and update
529
+ # the buffer.
530
+ input = ''
531
+ while char = Win32API.new("crtdll", "_getch", [ ], "I").Call do
532
+ break if char == 10 || char == 13 # return or newline
533
+ if char == 127 || char == 8 # backspace and delete
534
+ if input.length > 0
535
+ input.slice!(-1, 1)
536
+ end
537
+ else
538
+ input << char.chr
539
+ end
540
+ end
541
+ char = ''
542
+ input
543
+ end
544
+
545
+ def self.get_hidden_input_on_unix()
546
+ unless $stdin.tty?
547
+ raise 'Could not hook to stdin to hide input. If using SSH, try using -t flag while connecting to server.'
548
+ end
549
+ unless system 'stty -echo -icanon'
550
+ raise 'Could not hide input using stty command.'
551
+ end
552
+ input = $stdin.gets
553
+ ensure
554
+ unless system 'stty echo icanon'
555
+ raise 'Could not enable echoing of input. Try executing `stty echo icanon` to debug.'
556
+ end
557
+ input
558
+ end
559
+
560
+ def self.get_hidden_input(message='Please enter data: ')
561
+ unless message.nil?
562
+ print message
563
+ end
564
+ if versioncmp(ruby_version, '1.9.3') >= 0
565
+ require 'io/console'
566
+ input = $stdin.noecho(&:gets)
567
+ else
568
+ # Use hacks to get hidden input on Ruby <1.9.3
569
+ if self.windows?
570
+ input = self.get_hidden_input_on_windows()
571
+ else
572
+ input = self.get_hidden_input_on_unix()
573
+ end
574
+ end
575
+ input.chomp! if input
576
+ input
577
+ end
523
578
  end
524
579
  end
@@ -113,6 +113,8 @@ module MCollective
113
113
  Activemq.any_instance.stubs(:get_option).with("activemq.max_hbrlck_fails", 0).returns(0)
114
114
  Activemq.any_instance.stubs(:get_option).with("activemq.max_hbread_fails", 2).returns(2)
115
115
  Activemq.any_instance.stubs(:get_bool_option).with("activemq.base64", 'false').returns(false)
116
+ Activemq.any_instance.stubs(:get_bool_option).with("activemq.prompt_user", 'false').returns(false)
117
+ Activemq.any_instance.stubs(:get_bool_option).with("activemq.prompt_password", 'false').returns(false)
116
118
  Activemq.any_instance.stubs(:get_option).with("activemq.priority", 0).returns(0)
117
119
  Activemq.any_instance.stubs(:get_option).with("activemq.pool.size").returns(2)
118
120
  Activemq.any_instance.stubs(:get_option).with("activemq.pool.1.host").returns("host1")
@@ -114,6 +114,8 @@ module MCollective
114
114
  Rabbitmq.any_instance.stubs(:get_option).with("rabbitmq.max_hbrlck_fails", 0).returns(0)
115
115
  Rabbitmq.any_instance.stubs(:get_option).with("rabbitmq.max_hbread_fails", 2).returns(2)
116
116
  Rabbitmq.any_instance.stubs(:get_bool_option).with("rabbitmq.base64", 'false').returns(false)
117
+ Rabbitmq.any_instance.stubs(:get_bool_option).with("rabbitmq.prompt_user", 'false').returns(false)
118
+ Rabbitmq.any_instance.stubs(:get_bool_option).with("rabbitmq.prompt_password", 'false').returns(false)
117
119
  Rabbitmq.any_instance.stubs(:get_option).with("rabbitmq.pool.size").returns(2)
118
120
  Rabbitmq.any_instance.stubs(:get_option).with("rabbitmq.pool.1.host").returns("host1")
119
121
  Rabbitmq.any_instance.stubs(:get_option).with("rabbitmq.pool.1.port", 61613).returns(6163)
@@ -132,7 +132,7 @@ module MCollective
132
132
  it 'should create the correct dependency string' do
133
133
  PluginPackager.expects(:filter_dependencies).with('debian', data[:dependencies]).returns(data[:dependencies])
134
134
  result = packager.send(:build_dependency_string, data)
135
- result.should == 'dep1, dep2 (>=1.1), dep3 (>=1.1-2), mcollective-rspec-common (= ${binary:Version})'
135
+ result.should == 'dep1 | puppet-agent, dep2 (>=1.1) | puppet-agent, dep3 (>=1.1-2) | puppet-agent, mcollective-rspec-common (= ${binary:Version})'
136
136
  end
137
137
  end
138
138
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcollective-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.8.9
4
+ version: 2.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-20 00:00:00.000000000 Z
11
+ date: 2016-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: systemu