brpm_content_framework 0.2.52 → 0.2.53

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjNiNmVmMDUzMDIxN2Q4Zjg2MGQyZDUwYmYyMzAyNjlhZjQ4YjhjMA==
4
+ YjU3ZTAxNWFiMGNjYTJlMjI0NzQ0ZmMzZjRiYTY3Yzg3ODRkNTc5Zg==
5
5
  data.tar.gz: !binary |-
6
- YjdlOGI0NjBlYjk1ODkwZDRhNzg5ODEwMDZlZDQzOTM1ODk0ZDRiZg==
6
+ MDBlMTBhOTE4MWEwNDlhNGFmMWU4NzNmMDQ5YmYwOTYwNWZmN2IyNw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- Mzc2MGFiMDM0MDQ3MGM3ZGM3YzMxN2FkNDZlYzI1NWU2ODMyODRhZmVjNTIx
10
- M2ZkYThiZjExNDFhNDk1MjJjYzAzMDEzNzI5ODU5Y2IxNmIyMmIyNGJhNTkx
11
- OWVhOGM0MDY1ODVjM2Y4NjEwZTQzNDM2YWY4OTdhMzcwYjQzZGU=
9
+ ZjQ5OWRlYTEwZDEzZTg0ZmQ2Zjg2ZTRhZmViOTExODM3NTFjZThmMWZjZWM4
10
+ ZTcwZTNjZjUzZDU5YzVjNjdhNWZkNDM5MzJkMmY0ZmJlNmU0OTgxZDQ4ZWU4
11
+ YjQxNDFhMjEyNmY2OTNlYzdkOWJjZjM4NjQ4MDMwNGE1MzgwNmM=
12
12
  data.tar.gz: !binary |-
13
- ZGVmYjIwMGUzY2RlNGUwYTQ1ZjY3NzFkYTU3NWI0ZmVhMTJhMTIwYjg1MmYx
14
- M2JjNzAzY2Y5YjU2YzI5ZGM3M2UzNWViOWU2MzRmMDIyZWQwYWExZWVjNzE5
15
- MGQ2MzU5MGNkOGQ3MjJjZDM2OTRhYjMzY2FmNDA5ZDgxOWI0MWM=
13
+ MGY2NjJmOWI1M2YzZWFjYTEyYTQyNDBmODAxZGU0YTNmZjU4NWU3NjY3MjY3
14
+ NzczYWE4ZmE2YWIyODFjZjc0Y2FlMDRiNzVlZWY1YThiN2ViOWI0NmQ3ODQ5
15
+ ZmQ5ZTRiZGNjMzE1NDNjZTcwYTRlOGZmN2JkY2M1MDI1OWJiMzk=
data/config.yml CHANGED
@@ -1,4 +1,4 @@
1
- version: 0.2.52
1
+ version: 0.2.53
2
2
  author: Niek Bartholomeus
3
3
  email: niek.bartholomeus@gmail.com
4
4
  homepage: https://github.com/BMC-RLM/brpm_content_framework
data/lib/brpm_auto.rb CHANGED
@@ -105,12 +105,6 @@ class BrpmAuto
105
105
  @logger = SimpleLogger.new(log_file, also_log_to_console)
106
106
  end
107
107
 
108
- def is_windows?
109
- require 'rbconfig'
110
-
111
- RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/i
112
- end
113
-
114
108
  def run_from_brpm
115
109
  @params.run_from_brpm
116
110
  end
data/lib/utilities.rb CHANGED
@@ -1,9 +1,18 @@
1
+ require 'rbconfig'
1
2
  require 'open3'
2
3
 
3
4
  module Utilities
4
5
  EXIT_CODE_FAILURE = 'Exit_Code_Failure'
5
- Windows = (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/) unless defined?(Windows)
6
-
6
+
7
+ def is_windows?
8
+ RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/i
9
+ end
10
+
11
+ def is_jruby?
12
+
13
+ RbConfig::CONFIG['ruby_install_name'] =~ /jruby/i
14
+ end
15
+
7
16
  # Returns the dos path from a standard path
8
17
  #
9
18
  # ==== Attributes
@@ -47,7 +56,7 @@ module Utilities
47
56
 
48
57
  output_dir = File.join(BrpmAuto.params.output_dir,"#{precision_timestamp}")
49
58
  errfile = "#{output_dir}_stderr.txt"
50
- complete_command = "#{escaped_command} 2>#{errfile}" unless Windows
59
+ complete_command = "#{escaped_command} 2>#{errfile}" unless is_windows?
51
60
  fil = File.open(errfile, "w+")
52
61
  fil.close
53
62
 
@@ -78,7 +87,11 @@ module Utilities
78
87
  cmd_result
79
88
  end
80
89
 
81
- def execute_command(*commands)
90
+ def execute_command(command)
91
+ *commands=command
92
+ if is_jruby? #TODO work around for buggy jruby implementation of popen3
93
+ *commands = RbConfig::CONFIG['SHELL'], is_windows? ? "?C" : "-c", command
94
+ end
82
95
  Open3.popen3(*commands) do |stdin, stdout, stderr, thread|
83
96
  logs = {:out => "", :err => ""}
84
97
 
@@ -280,10 +293,6 @@ module Utilities
280
293
  result
281
294
  end
282
295
 
283
- def windows?
284
- Windows
285
- end
286
-
287
296
  def privatize(expression, sensitive_data = BrpmAuto.params.private_params.values)
288
297
  unless sensitive_data.nil? or sensitive_data.empty?
289
298
  sensitive_data = [sensitive_data] if sensitive_data.kind_of?(String)
@@ -330,7 +339,7 @@ module Utilities
330
339
 
331
340
  #TODO: still needed? the framework's error handling should take care of this already
332
341
  def exit_code_failure
333
- return "" if Windows
342
+ return "" if is_windows?
334
343
  size_ = EXIT_CODE_FAILURE.size
335
344
  exit_code_failure_first_part = EXIT_CODE_FAILURE[0..3]
336
345
  exit_code_failure_second_part = EXIT_CODE_FAILURE[4..size_]
@@ -291,7 +291,7 @@ class DispatchBase
291
291
  instance_path = File.join(staging_path, package_file)
292
292
  staging_artifacts = Dir.entries(staging_path).reject{|k| [".",".."].include?(k) }
293
293
  return {"instance_path" => "ERROR - no files in staging area", "md5" => ""} if staging_artifacts.size < 1
294
- cmd = "cd #{staging_path} && zip -r #{package_file} *" unless Windows
294
+ cmd = "cd #{staging_path} && zip -r #{package_file} *" unless BrpmAuto.is_windows?
295
295
  result = execute_shell(cmd)
296
296
  md5 = Digest::MD5.file(instance_path).hexdigest
297
297
  {"instance_path" => instance_path, "md5" => md5, "manifest" => staging_artifacts}
@@ -186,7 +186,7 @@ class TransportNSH
186
186
  err_file = touch_file("#{script_dir}/nsh_errors_#{Time.now.strftime("%Y%m%d%H%M%S%L")}.txt")
187
187
  script_path = "\"#{script_path}\"" if script_path.include?(" ")
188
188
  cmd = "#{nsh_cmd("scriptutil")} -d \"#{nsh_path(target_path)}\" -h #{target_hosts.join(" ")} -s #{script_path}"
189
- cmd = cmd + " 2>#{err_file}" unless BrpmAuto.windows?
189
+ cmd = cmd + " 2>#{err_file}" unless BrpmAuto.is_windows?
190
190
  result = execute_shell(cmd)
191
191
  result["stderr"] = "#{result["stderr"]}\n#{File.open(err_file).read}"
192
192
  result = display_result(result) unless raw_result
@@ -353,7 +353,7 @@ class TransportNSH
353
353
 
354
354
  def platform_temp
355
355
  res = "/tmp"
356
- res = "C:/Windows/temp" if BrpmAuto.windows?
356
+ res = "C:/Windows/temp" if BrpmAuto.is_windows?
357
357
  res
358
358
  end
359
359
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: brpm_content_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.52
4
+ version: 0.2.53
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niek Bartholomeus