Chef_Solo_Nodes 0.2.2 → 0.2.3
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.
- data/README.md +6 -2
 - data/lib/Chef_Solo_Nodes.rb +13 -6
 - data/lib/Chef_Solo_Nodes/version.rb +1 -1
 - metadata +1 -1
 
    
        data/README.md
    CHANGED
    
    | 
         @@ -60,8 +60,12 @@ Executable Usage: SSH 
     | 
|
| 
       60 
60 
     | 
    
         
             
            Implementation
         
     | 
| 
       61 
61 
     | 
    
         
             
            --------------
         
     | 
| 
       62 
62 
     | 
    
         | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
            Chef\_Solo\_IPS() also does some magic. It's easier to
         
     | 
| 
      
 63 
     | 
    
         
            +
            It's easier to
         
     | 
| 
       65 
64 
     | 
    
         
             
            understand if you see the code. 
         
     | 
| 
       66 
65 
     | 
    
         
             
            [It's just one page long.](https://github.com/da99/Chef_Solo_Nodes/blob/master/lib/Chef_Solo_Nodes.rb)
         
     | 
| 
       67 
66 
     | 
    
         | 
| 
      
 67 
     | 
    
         
            +
            [bin/SSH](https://github.com/da99/Chef_Solo_Nodes/blob/master/bin/SSH)
         
     | 
| 
      
 68 
     | 
    
         
            +
             
     | 
| 
      
 69 
     | 
    
         
            +
            [bin/IP](https://github.com/da99/Chef_Solo_Nodes/blob/master/bin/IP)
         
     | 
| 
      
 70 
     | 
    
         
            +
             
     | 
| 
      
 71 
     | 
    
         
            +
             
     | 
    
        data/lib/Chef_Solo_Nodes.rb
    CHANGED
    
    | 
         @@ -1,22 +1,29 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            require 'Chef_Solo_Nodes/version'
         
     | 
| 
       2 
2 
     | 
    
         
             
            require "json"
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
            # 
         
     | 
| 
      
 5 
     | 
    
         
            +
            #  Arguments:
         
     | 
| 
      
 6 
     | 
    
         
            +
            #
         
     | 
| 
      
 7 
     | 
    
         
            +
            #    role_or_paths = File paths Array OR Role name String.
         
     | 
| 
      
 8 
     | 
    
         
            +
            #
         
     | 
| 
      
 9 
     | 
    
         
            +
            #
         
     | 
| 
      
 10 
     | 
    
         
            +
            def Chef_Solo_Nodes role_or_paths = '*'
         
     | 
| 
       5 
11 
     | 
    
         | 
| 
       6 
     | 
    
         
            -
              if  
     | 
| 
      
 12 
     | 
    
         
            +
              if role_or_paths.is_a?(Array)
         
     | 
| 
       7 
13 
     | 
    
         
             
                role = '*'
         
     | 
| 
       8 
     | 
    
         
            -
                 
     | 
| 
      
 14 
     | 
    
         
            +
                files = role_or_paths
         
     | 
| 
       9 
15 
     | 
    
         
             
              else
         
     | 
| 
       10 
     | 
    
         
            -
                role =  
     | 
| 
       11 
     | 
    
         
            -
                 
     | 
| 
      
 16 
     | 
    
         
            +
                role = role_or_paths.to_s
         
     | 
| 
      
 17 
     | 
    
         
            +
                files = Dir.glob("nodes/*.json")
         
     | 
| 
       12 
18 
     | 
    
         
             
              end
         
     | 
| 
       13 
19 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              files.map { |str| 
         
     | 
| 
       15 
21 
     | 
    
         
             
                h = JSON(File.read(str))
         
     | 
| 
       16 
22 
     | 
    
         
             
                next if role != '*' && !(h['roles'] || []).include?(role)
         
     | 
| 
       17 
23 
     | 
    
         
             
                h['ipaddress'] ||= File.basename(str).sub(".json", "")
         
     | 
| 
       18 
24 
     | 
    
         
             
                h
         
     | 
| 
       19 
25 
     | 
    
         
             
              }.compact
         
     | 
| 
      
 26 
     | 
    
         
            +
              
         
     | 
| 
       20 
27 
     | 
    
         
             
            end
         
     | 
| 
       21 
28 
     | 
    
         | 
| 
       22 
29 
     | 
    
         
             
            def Chef_Solo_IPs *args
         
     |