Permalink
Browse files

Start to pull out eharmony settings. Need to rewrite tests

  • Loading branch information...
1 parent 75245fe commit 680eda98674424d3aece1aab950388bac6346529 @porcupie porcupie committed Nov 20, 2012
Showing with 11 additions and 6 deletions.
  1. +3 −3 lib/nv_helpers/nv_wrapper.rb
  2. +3 −1 nv_helpers.gemspec
  3. +1 −1 nv_helpers.spec
  4. +4 −1 tests/test_nv_wrapper.rb
View
6 lib/nv_helpers/nv_wrapper.rb
@@ -10,7 +10,7 @@ def initialize(nv_config={})
# nventory client config hash uses symbol. Make sure we convert all
# the keys to symbols
@nv_config = nv_config.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
- @nv_config[:server] ||= "http://nventory.corp.eharmony.com"
+ @nv_config[:server] ||= "http://nventory"
if @nv_config[:server] !~ /^http/
@nv_config[:server] = "http://" + @nv_config[:server]
end
@@ -19,7 +19,7 @@ def initialize(nv_config={})
@nvclient = NVentory::Client.new(@nv_config)
end
-
+
def set_nv_server_url(url)
@nv_config[:server] = url
@nvclient = NVentory::Client.new(@nv_config)
@@ -32,7 +32,7 @@ def method_missing method_id, *args
def delete_objects(objecttypes, data)
@nvclient.delete_objects(objecttypes, data, @username, @password)
end
-
+
def delete_nodes(data)
delete_objects('nodes', data)
end
View
4 nv_helpers.gemspec
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
s.summary = %q{Helpers for dealing with nVentory}
s.description = %q{This package includes helper scripts for dealing with nVentory}
- # probably don't want to push here
+ # probably don't want to push to rubyforge
#s.rubyforge_project = "nv_helpers"
NV_IGNORE_FILES = %w{.rvmrc} unless defined?(NV_IGNORE_FILES)
@@ -21,5 +21,7 @@ Gem::Specification.new do |s|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
s.require_paths = ["lib"]
+ s.add_development_dependency "rake"
+
s.add_runtime_dependency "nventory-client"
end
View
2 nv_helpers.spec
@@ -3,7 +3,7 @@ Summary: helper scripts for dealing with nVentory
Name: nv_helpers
# Version: This must be the version string from the rpm filename you plan to
# use. This is replaced at rpm build time with NvHelpers::VERSION.
-Version: NvHelpers::VERSION
+Version: NvHelpers::VERSION
# Release: This is the release number for a package of the same version (ie. if
# we make a package and find it to be slightly broken and need to make it
# again, the next package would be release number 2).
View
5 tests/test_nv_wrapper.rb
@@ -9,8 +9,11 @@ def test_initialize
assert_nothing_raised{ NvHelpers::NvWrapper.new({'server' => 'nventory.dev.corp.eharmony.com', 'username' => 'ddao'}) }
assert_nothing_raised{ NvHelpers::NvWrapper.new({'server' => 'nventory.dev.corp.eharmony.com', 'username' => 'ddao', 'password' => 'secret'}) }
end
+
def test_get_nodes
- nv_helper = NvHelpers::NvWrapper.new
+ # NOTE: presumes objects that exist in the eharmony Production server ...
+ nv_helper = NvHelpers::NvWrapper.new({'server' => 'nventory.corp.eharmony.com'})
+
result = nv_helper.get_nodes({:get => {:name => "prod.dc1.eharmony.com", 'network_interfaces[name]' => "eth0"},
:includes => ['network_interfaces[ip_addresses]']})
assert(!result.empty?)

0 comments on commit 680eda9

Please sign in to comment.