kitchen-binding 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  kitchen-binding
2
2
  ===============
3
+ [![Gem Version](https://badge.fury.io/rb/kitchen-binding.svg)](https://rubygems.org/gems/kitchen-binding)
4
+ [![Dependency Status](https://gemnasium.com/jmccann/kitchen-binding.svg)](https://gemnasium.com/jmccann/kitchen-binding)
3
5
 
4
6
  kitchen-binding is an extension to [test-kitchen](https://github.com/test-kitchen/test-kitchen) to allow setting breakpoints in your cookbooks. When encountered during a converge test-kitchen will then login to an interactive ruby shell for your debugging pleasure. When you are finished the converge will continue where it left of. It will continue to pickup any other breakpoints you may have setup through the run as well.
5
7
 
@@ -16,7 +18,9 @@ Currently there is some required pre-setup you will need to do in order to use t
16
18
 
17
19
  ### Instance Networking
18
20
 
19
- The instance must currently have a 33.33.33.200 IP accessbile from the host as this is currently hardcoded. This is one of the first things I plan on working to address.
21
+ If you are using vagrant then the instance must currently have a 33.33.33.200 IP accessbile from the host as this is currently hardcoded. This is one of the first things I plan on working to address.
22
+
23
+ If you are using Openstack or some other driver it should just work.
20
24
 
21
25
  #### Vagrant
22
26
  If you are using a vagrant driver you will need to have a virtual private newtwork setup on the guest with an IP. This is a requirement for the default binding plugin 'pry-remote' as pry-remote's dependencies use RPC which eventually uses a random port that you can not dynamically create a port forward for (or atleast not easily). An idea to make this easier would be to setup a virtual private network for all of your vagrant instances by setting the following in your ~/.kitchen/config.yml
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'kitchen-binding'
7
- gem.version = '0.2.0'
7
+ gem.version = '0.2.1'
8
8
  gem.license = 'Apache 2.0'
9
9
  gem.authors = ['Jacob McCann']
10
10
  gem.email = ['jmcann.git@gmail.com']
@@ -25,15 +25,15 @@ module Kitchen
25
25
  #
26
26
  # @author Jacob McCann <jmccann.git@gmail.com>
27
27
  module Binding
28
- # Default provisioner to use
28
+ # Default binding to use
29
29
  DEFAULT_PLUGIN = 'pry_remote'.freeze
30
30
 
31
31
  # Returns an instance of a binding given a plugin type string.
32
32
  #
33
33
  # @param plugin [String] a binding plugin type, to be constantized
34
- # @param config [Hash] a configuration hash to initialize the provisioner
34
+ # @param config [Hash] a configuration hash to initialize the binding
35
35
  # @return [Binding::Base] a driver instance
36
- # @raise [ClientError] if a provisioner instance could not be created
36
+ # @raise [ClientError] if a binding instance could not be created
37
37
  def self.for_plugin(plugin, config)
38
38
  require("kitchen/binding/#{plugin}")
39
39
 
@@ -29,9 +29,6 @@ module Kitchen
29
29
  #
30
30
  # @author Jacob McCann <jmccann.git@gmail.com>
31
31
  class Base
32
- # require 'pry'
33
- # binding.pry
34
-
35
32
  # include Configurable # Available in edge test-kitchen
36
33
  include Logging
37
34
 
@@ -132,7 +129,8 @@ module Kitchen
132
129
  # @return [String] Binding hostname
133
130
  # @api private
134
131
  def hostname
135
- '33.33.33.200'
132
+ return '33.33.33.200' if state[:hostname] == '127.0.0.1'
133
+ state[:hostname]
136
134
  end
137
135
 
138
136
  # String representation of object, reporting its connection details and
@@ -24,81 +24,6 @@ module Kitchen
24
24
  # @author Fletcher Nichol <fnichol@nichol.ca>
25
25
  module Util
26
26
 
27
- # # Returns the standard library Logger level constants for a given symbol
28
- # # representation.
29
- # #
30
- # # @param symbol [Symbol] symbol representation of a logger level (:debug,
31
- # # :info, :warn, :error, :fatal)
32
- # # @return [Integer] Logger::Severity constant value or nil if input is not
33
- # # valid
34
- # def self.to_logger_level(symbol)
35
- # return nil unless [:debug, :info, :warn, :error, :fatal].include?(symbol)
36
-
37
- # Logger.const_get(symbol.to_s.upcase)
38
- # end
39
-
40
- # # Returns the symbol represenation of a logging levels for a given
41
- # # standard library Logger::Severity constant.
42
- # #
43
- # # @param const [Integer] Logger::Severity constant value for a logging
44
- # # level (Logger::DEBUG, Logger::INFO, Logger::WARN, Logger::ERROR,
45
- # # Logger::FATAL)
46
- # # @return [Symbol] symbol representation of the logging level
47
- # def self.from_logger_level(const)
48
- # case const
49
- # when Logger::DEBUG then :debug
50
- # when Logger::INFO then :info
51
- # when Logger::WARN then :warn
52
- # when Logger::ERROR then :error
53
- # else :fatal
54
- # end
55
- # end
56
-
57
- # # Returns a new Hash with all key values coerced to symbols. All keys
58
- # # within a Hash are coerced by calling #to_sym and hashes within arrays
59
- # # and other hashes are traversed.
60
- # #
61
- # # @param obj [Object] the hash to be processed. While intended for
62
- # # hashes, this method safely processes arbitrary objects
63
- # # @return [Object] a converted hash with all keys as symbols
64
- # def self.symbolized_hash(obj)
65
- # if obj.is_a?(Hash)
66
- # obj.inject({}) { |h, (k, v)| h[k.to_sym] = symbolized_hash(v); h }
67
- # elsif obj.is_a?(Array)
68
- # obj.inject([]) { |a, e| a << symbolized_hash(e); a }
69
- # else
70
- # obj
71
- # end
72
- # end
73
-
74
- # # Returns a new Hash with all key values coerced to strings. All keys
75
- # # within a Hash are coerced by calling #to_s and hashes with arrays
76
- # # and other hashes are traversed.
77
- # #
78
- # # @param obj [Object] the hash to be processed. While intended for
79
- # # hashes, this method safely processes arbitrary objects
80
- # # @return [Object] a converted hash with all keys as strings
81
- # def self.stringified_hash(obj)
82
- # if obj.is_a?(Hash)
83
- # obj.inject({}) { |h, (k, v)| h[k.to_s] = stringified_hash(v); h }
84
- # elsif obj.is_a?(Array)
85
- # obj.inject([]) { |a, e| a << stringified_hash(e); a }
86
- # else
87
- # obj
88
- # end
89
- # end
90
-
91
- # # Returns a formatted string representing a duration in seconds.
92
- # #
93
- # # @param total [Integer] the total number of seconds
94
- # # @return [String] a formatted string of the form (XmYY.00s)
95
- # def self.duration(total)
96
- # total = 0 if total.nil?
97
- # minutes = (total / 60).to_i
98
- # seconds = (total - (minutes * 60))
99
- # format("(%dm%.2fs)", minutes, seconds)
100
- # end
101
-
102
27
  # Generates a command (or series of commands) wrapped so that it can be
103
28
  # invoked on a remote instance or locally.
104
29
  #
@@ -115,33 +40,5 @@ module Kitchen
115
40
  "sh -c '\n#{cmd}\n'"
116
41
  end
117
42
 
118
- # # Modifes the given string to strip leading whitespace on each line, the
119
- # # amount which is calculated by using the first line of text.
120
- # #
121
- # # @example
122
- # #
123
- # # string = <<-STRING
124
- # # a
125
- # # b
126
- # # c
127
- # # STRING
128
- # # Util.outdent!(string) # => "a\n b\nc\n"
129
- # #
130
- # # @param string [String] the string that will be modified
131
- # # @return [String] the modified string
132
- # def self.outdent!(string)
133
- # string.gsub!(/^ {#{string.index(/[^ ]/)}}/, "")
134
- # end
135
-
136
- # # Returns a set of Bourne Shell (AKA /bin/sh) compatible helper
137
- # # functions. This function is usually called inline in a string that
138
- # # will be executed remotely on a test instance.
139
- # #
140
- # # @return [String] a string representation of useful helper functions
141
- # def self.shell_helpers
142
- # IO.read(File.join(
143
- # File.dirname(__FILE__), %w[.. .. support download_helpers.sh]
144
- # ))
145
- # end
146
43
  end
147
44
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-binding
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
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: 2014-10-31 00:00:00.000000000 Z
12
+ date: 2014-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-kitchen