elecksee 1.0.16 → 1.0.18

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## v1.0.18
2
+ * Use shellwords to properly break down commands
3
+ * Force hash type as required
4
+ * Return expected type on command failure
5
+ * Remove custom `run_command` and use helper based method instead
6
+
1
7
  ## v1.0.16
2
8
  * Fix syntax bug in `Lxc::FileConfig` (thanks @mikerowehl)
3
9
 
@@ -1,3 +1,5 @@
1
+ require 'shellwords'
2
+
1
3
  class Lxc
2
4
  class CommandFailed < StandardError
3
5
  attr_accessor :original, :result
@@ -65,7 +67,7 @@ class Lxc
65
67
  else
66
68
  raise ArgumentError.new("Unknown shellout helper provided: #{cmd_type}")
67
69
  end
68
- CommandResult.new(result)
70
+ result == false ? false : CommandResult.new(result)
69
71
  end
70
72
 
71
73
  def child_process_command(cmd, args)
@@ -76,9 +78,7 @@ class Lxc
76
78
  s_err = Tempfile.new('stderr')
77
79
  s_out.sync
78
80
  s_err.sync
79
- cmd_parts = cmd.split(' ')
80
- cmd_parts.delete_if(&:empty?)
81
- c_proc = ChildProcess.build(*cmd_parts)
81
+ c_proc = ChildProcess.build(*Shellwords.split(cmd))
82
82
  c_proc.environment.merge('HOME' => detect_home)
83
83
  c_proc.io.stdout = s_out
84
84
  c_proc.io.stderr = s_err
data/lib/elecksee/lxc.rb CHANGED
@@ -333,7 +333,7 @@ class Lxc
333
333
  end
334
334
  end
335
335
  alias_method :knife_container, :direct_container_command
336
-
336
+ =begin
337
337
  # Simple helper to shell out
338
338
  def run_command(cmd, args={})
339
339
  retries = args[:allow_failure_retry].to_i
@@ -361,7 +361,7 @@ class Lxc
361
361
  end
362
362
  end
363
363
  end
364
-
364
+ =end
365
365
  def wait_for_state(desired_state, args={})
366
366
  args[:sleep_interval] ||= 1.0
367
367
  wait_total = 0.0
@@ -9,7 +9,7 @@ class Lxc
9
9
  def convert_to_hash(thing)
10
10
  unless(thing.is_a?(Hash))
11
11
  result = defined?(Mash) ? Mash.new : {}
12
- thing.each do |k,v|
12
+ thing.to_hash.each do |k,v|
13
13
  result[k] = v.respond_to?(:keys) && v.respond_to?(:values) ? convert_to_hash(v) : v
14
14
  end
15
15
  end
@@ -2,5 +2,5 @@ module Elecksee
2
2
  class Version < Gem::Version
3
3
  end
4
4
 
5
- VERSION = Version.new('1.0.16')
5
+ VERSION = Version.new('1.0.18')
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elecksee
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.16
4
+ version: 1.0.18
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-15 00:00:00.000000000 Z
12
+ date: 2013-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mixlib-shellout