]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
replaced 'manager.provider' with 'provider'
authorelijah <elijah@riseup.net>
Tue, 22 Jan 2013 06:50:17 +0000 (22:50 -0800)
committerelijah <elijah@riseup.net>
Tue, 22 Jan 2013 06:50:17 +0000 (22:50 -0800)
bin/leap
lib/leap_cli/commands/deploy.rb
lib/leap_cli/commands/vagrant.rb
test/test_helper.rb
test/unit/config_object_list_test.rb
test/unit/config_object_test.rb

index 690a5609525b2d2579d49646e7610cf878e8a46e..5c0d2e8f491d1b27fcb9749e435bfb1965572ed0 100755 (executable)
--- a/bin/leap
+++ b/bin/leap
@@ -61,6 +61,13 @@ module LeapCli::Commands
     end
   end
 
+  #
+  # make provider config available as 'provider'
+  #
+  def self.provider
+    manager.provider
+  end
+
   #
   # info about leap command line suite
   #
index 37901f4b19fbd63e29c310832cf63f9dc61a5854..3cc1d58c3df8b60e12ea5389bdd30fa64a03d9b9 100644 (file)
@@ -24,7 +24,7 @@ module LeapCli
             ssh.leap.assert_initialized
           end
 
-          ssh.leap.log :syching, "configuration files" do
+          ssh.leap.log :synching, "configuration files" do
             sync_hiera_config(ssh)
             sync_support_files(ssh)
           end
@@ -44,7 +44,7 @@ module LeapCli
     private
 
     def sync_hiera_config(ssh)
-      dest_dir = manager.provider.hiera_sync_destination
+      dest_dir = provider.hiera_sync_destination
       ssh.leap.rsync_update do |server|
         node = manager.node(server.host)
         hiera_file = Path.relative_path([:hiera, node.name])
@@ -54,7 +54,7 @@ module LeapCli
     end
 
     def sync_support_files(ssh)
-      dest_dir = manager.provider.hiera_sync_destination
+      dest_dir = provider.hiera_sync_destination
       ssh.leap.rsync_update do |server|
         node = manager.node(server.host)
         files_to_sync = node.file_paths.collect {|path| Path.relative_path(path, Path.provider) }
index be65e20a1a78a66fa6c23de578ae2b5e7a9c7ceb..dfa32f2e42cb2ee933263a1f338df24fa2d1d5d2 100644 (file)
@@ -82,7 +82,7 @@ module LeapCli; module Commands
       end
       execute exec.join('; ')
     else
-      bail! "No nodes found. This command only works on nodes with ip_address in the network #{manager.provider.vagrant.network}"
+      bail! "No nodes found. This command only works on nodes with ip_address in the network #{provider.vagrant.network}"
     end
   end
 
@@ -104,7 +104,7 @@ module LeapCli; module Commands
 
   def create_vagrant_file
     lines = []
-    netmask = IPAddr.new('255.255.255.255').mask(manager.provider.vagrant.network.split('/').last).to_s
+    netmask = IPAddr.new('255.255.255.255').mask(provider.vagrant.network.split('/').last).to_s
     lines << %[Vagrant::Config.run do |config|]
     manager.each_node do |node|
       if node.vagrant?
@@ -127,7 +127,7 @@ module LeapCli; module Commands
       highest_ip = taken_ips.map{|ip| IPAddr.new(ip)}.max
       new_ip = highest_ip.succ
     else
-      new_ip = IPAddr.new(manager.provider.vagrant.network).succ.succ
+      new_ip = IPAddr.new(provider.vagrant.network).succ.succ
     end
     return new_ip.to_s
   end
index 94bb2b4be1e567198f3de8d8f27111534b942438..c75222b547d02087ae44ac4bc36fac24a528f7ce 100644 (file)
@@ -21,6 +21,10 @@ class MiniTest::Unit::TestCase
     end
   end
 
+  def provider
+    manager.provider
+  end
+
   def base_path
     File.expand_path '../..', __FILE__
   end
index a507094e6d43834942454246e16121ab90eca741..ecb6d4eafa0e14e16592da62ecf8b6a90cda47fd 100644 (file)
@@ -9,7 +9,7 @@ class ConfigObjectListTest < MiniTest::Unit::TestCase
   end
 
   def test_complex_node_search
-    domain = manager.provider.domain
+    domain = provider.domain
     nodes = manager.nodes['dns.public' => true]
     expected = [{"domain_full"=>"ns1.#{domain}"}, {"domain_full"=>"ns2.#{domain}"}, {"domain_full"=>"vpn1.#{domain}"}, {"domain_full"=>"web1.#{domain}"}]
     assert_equal expected.size, nodes.size
index b981f3b44d235f65a1bb0d71a73c7cfd225829e2..79cf5967539d1138d9cf56e34968cc5458da8809 100644 (file)
@@ -3,7 +3,7 @@ require File.expand_path('test_helper', File.dirname(__FILE__))
 class ConfigObjectTest < MiniTest::Unit::TestCase
 
   def test_bracket_lookup
-    domain = manager.provider.domain
+    domain = provider.domain
     vpn1 = manager.nodes['vpn1']
     assert_equal "vpn1.#{domain}", vpn1['domain.full']
   end