knife-openstack 0.5.1 → 0.5.2
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.rdoc
    CHANGED
    
    | 
         @@ -6,25 +6,31 @@ This is the official Opscode Knife plugin for OpenStack Compute (Nova). This plu 
     | 
|
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            = INSTALLATION:
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
            Be sure you are running the beta version of Chef which supports plugins:
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                $ gem install chef --version 0.10.0.beta.6
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
       9 
13 
     | 
    
         
             
            This plugin is distributed as a Ruby Gem. To install it, run:
         
     | 
| 
       10 
14 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                gem install knife-openstack
         
     | 
| 
      
 15 
     | 
    
         
            +
                $ gem install knife-openstack
         
     | 
| 
       12 
16 
     | 
    
         | 
| 
       13 
17 
     | 
    
         
             
            Depending on your system's configuration, you may need to run this command with root privileges.
         
     | 
| 
       14 
18 
     | 
    
         | 
| 
       15 
19 
     | 
    
         
             
            = CONFIGURATION:
         
     | 
| 
       16 
20 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            In order to communicate with an OpenStack Compute cloud's API you will have to tell Knife about your OpenStack Compute cloud API endpoint, OpenStack Access Key and Secret Access Key.  The easiest way to accomplish this is to create some entries in your <tt>knife.rb</tt> file:
         
     | 
| 
      
 21 
     | 
    
         
            +
            In order to communicate with an OpenStack Compute cloud's EC2 API you will have to tell Knife about your OpenStack Compute cloud API endpoint, OpenStack Access Key and Secret Access Key.  The easiest way to accomplish this is to create some entries in your <tt>knife.rb</tt> file:
         
     | 
| 
       18 
22 
     | 
    
         | 
| 
      
 23 
     | 
    
         
            +
                ### Note: You may need to append the :openstack_access_key_id with ":$PROJECT_NAME", if it differs from your OpenStack Username.
         
     | 
| 
       19 
24 
     | 
    
         
             
                knife[:openstack_access_key_id]     = "Your OpenStack Access Key ID"
         
     | 
| 
       20 
25 
     | 
    
         
             
                knife[:openstack_secret_access_key] = "Your OpenStack Secret Access Key"
         
     | 
| 
       21 
     | 
    
         
            -
                 
     | 
| 
      
 26 
     | 
    
         
            +
                ### Note: If you are not proxying HTTPS to the OpenStack EC2 API port, the scheme should be HTTP, and the PORT is 8773.
         
     | 
| 
      
 27 
     | 
    
         
            +
                knife[:openstack_api_endpoint]      = "https://cloud.mycompany.com/service/Cloud"
         
     | 
| 
       22 
28 
     | 
    
         | 
| 
       23 
29 
     | 
    
         
             
            If your knife.rb file will be checked into a SCM system (ie readable by others) you may want to read the values from environment variables:
         
     | 
| 
       24 
30 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
                knife[:openstack_access_key_id]     = "#{ENV[' 
     | 
| 
       26 
     | 
    
         
            -
                knife[:openstack_secret_access_key] = "#{ENV[' 
     | 
| 
       27 
     | 
    
         
            -
                knife[:openstack_api_endpoint]      = " 
     | 
| 
      
 31 
     | 
    
         
            +
                knife[:openstack_access_key_id]     = "#{ENV['EC2_ACCESS_KEY']}"
         
     | 
| 
      
 32 
     | 
    
         
            +
                knife[:openstack_secret_access_key] = "#{ENV['EC2_SECRET_KEY']}"
         
     | 
| 
      
 33 
     | 
    
         
            +
                knife[:openstack_api_endpoint]      = "#{ENV['EC2_URL']}"
         
     | 
| 
       28 
34 
     | 
    
         | 
| 
       29 
35 
     | 
    
         
             
            You also have the option of passing your OpenStack API Key/Secret into the individual knife subcommands using the <tt>-A</tt> (or <tt>--openstack-access-key-id</tt>) <tt>-K</tt> (or <tt>--openstack-secret-access-key</tt>) command options
         
     | 
| 
       30 
36 
     | 
    
         | 
| 
         @@ -81,4 +87,4 @@ Unless required by applicable law or agreed to in writing, software 
     | 
|
| 
       81 
87 
     | 
    
         
             
            distributed under the License is distributed on an "AS IS" BASIS,
         
     | 
| 
       82 
88 
     | 
    
         
             
            WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
         
     | 
| 
       83 
89 
     | 
    
         
             
            See the License for the specific language governing permissions and
         
     | 
| 
       84 
     | 
    
         
            -
            limitations under the License.
         
     | 
| 
      
 90 
     | 
    
         
            +
            limitations under the License.
         
     | 
| 
         @@ -171,8 +171,6 @@ class Chef 
     | 
|
| 
       171 
171 
     | 
    
         
             
                      :region => locate_config_value(:region)
         
     | 
| 
       172 
172 
     | 
    
         
             
                    )
         
     | 
| 
       173 
173 
     | 
    
         | 
| 
       174 
     | 
    
         
            -
                    ami = connection.images.get(locate_config_value(:image))
         
     | 
| 
       175 
     | 
    
         
            -
             
     | 
| 
       176 
174 
     | 
    
         
             
                    server_def = {
         
     | 
| 
       177 
175 
     | 
    
         
             
                      :image_id => locate_config_value(:image),
         
     | 
| 
       178 
176 
     | 
    
         
             
                      :groups => config[:security_groups],
         
     | 
| 
         @@ -180,33 +178,7 @@ class Chef 
     | 
|
| 
       180 
178 
     | 
    
         
             
                      :key_name => Chef::Config[:knife][:openstack_ssh_key_id],
         
     | 
| 
       181 
179 
     | 
    
         
             
                      :availability_zone => Chef::Config[:knife][:availability_zone]
         
     | 
| 
       182 
180 
     | 
    
         
             
                    }
         
     | 
| 
       183 
     | 
    
         
            -
             
     | 
| 
       184 
     | 
    
         
            -
             
     | 
| 
       185 
     | 
    
         
            -
                  if ami.root_device_type == "ebs"
         
     | 
| 
       186 
     | 
    
         
            -
                    ami_map = ami.block_device_mapping.first
         
     | 
| 
       187 
     | 
    
         
            -
                    ebs_size = begin
         
     | 
| 
       188 
     | 
    
         
            -
                                 if config[:ebs_size]
         
     | 
| 
       189 
     | 
    
         
            -
                                   Integer(config[:ebs_size]).to_s
         
     | 
| 
       190 
     | 
    
         
            -
                                 else
         
     | 
| 
       191 
     | 
    
         
            -
                                   ami_map["volumeSize"].to_s
         
     | 
| 
       192 
     | 
    
         
            -
                                 end
         
     | 
| 
       193 
     | 
    
         
            -
                               rescue ArgumentError
         
     | 
| 
       194 
     | 
    
         
            -
                                 puts "--ebs-size must be an integer"
         
     | 
| 
       195 
     | 
    
         
            -
                                 msg opt_parser
         
     | 
| 
       196 
     | 
    
         
            -
                                 exit 1
         
     | 
| 
       197 
     | 
    
         
            -
                               end
         
     | 
| 
       198 
     | 
    
         
            -
                    delete_term = if config[:ebs_no_delete_on_term]
         
     | 
| 
       199 
     | 
    
         
            -
                                    "false"
         
     | 
| 
       200 
     | 
    
         
            -
                                  else
         
     | 
| 
       201 
     | 
    
         
            -
                                    ami_map["deleteOnTermination"]
         
     | 
| 
       202 
     | 
    
         
            -
                                  end
         
     | 
| 
       203 
     | 
    
         
            -
                    server_def[:block_device_mapping] =
         
     | 
| 
       204 
     | 
    
         
            -
                      [{
         
     | 
| 
       205 
     | 
    
         
            -
                         'DeviceName' => ami_map["deviceName"],
         
     | 
| 
       206 
     | 
    
         
            -
                         'Ebs.VolumeSize' => ebs_size,
         
     | 
| 
       207 
     | 
    
         
            -
                         'Ebs.DeleteOnTermination' => delete_term
         
     | 
| 
       208 
     | 
    
         
            -
                       }]
         
     | 
| 
       209 
     | 
    
         
            -
                  end
         
     | 
| 
      
 181 
     | 
    
         
            +
             
     | 
| 
       210 
182 
     | 
    
         
             
                    server = connection.servers.create(server_def)
         
     | 
| 
       211 
183 
     | 
    
         | 
| 
       212 
184 
     | 
    
         
             
                    puts "#{ui.color("Instance ID", :cyan)}: #{server.id}"
         
     | 
| 
         @@ -226,7 +198,7 @@ class Chef 
     | 
|
| 
       226 
198 
     | 
    
         
             
                    puts("\n")
         
     | 
| 
       227 
199 
     | 
    
         | 
| 
       228 
200 
     | 
    
         
             
                    puts "#{ui.color("Public DNS Name", :cyan)}: #{server.dns_name}"
         
     | 
| 
       229 
     | 
    
         
            -
                    puts "#{ui.color("Public IP Address", :cyan)}: #{server. 
     | 
| 
      
 201 
     | 
    
         
            +
                    puts "#{ui.color("Public IP Address", :cyan)}: #{server.public_ip_address}"
         
     | 
| 
       230 
202 
     | 
    
         
             
                    puts "#{ui.color("Private DNS Name", :cyan)}: #{server.private_dns_name}"
         
     | 
| 
       231 
203 
     | 
    
         
             
                    puts "#{ui.color("Private IP Address", :cyan)}: #{server.private_ip_address}"
         
     | 
| 
       232 
204 
     | 
    
         | 
| 
         @@ -246,7 +218,7 @@ class Chef 
     | 
|
| 
       246 
218 
     | 
    
         
             
                    puts "#{ui.color("Availability Zone", :cyan)}: #{server.availability_zone}"
         
     | 
| 
       247 
219 
     | 
    
         
             
                    puts "#{ui.color("Security Groups", :cyan)}: #{server.groups.join(", ")}"
         
     | 
| 
       248 
220 
     | 
    
         
             
                    puts "#{ui.color("Public DNS Name", :cyan)}: #{server.dns_name}"
         
     | 
| 
       249 
     | 
    
         
            -
                    puts "#{ui.color("Public IP Address", :cyan)}: #{server. 
     | 
| 
      
 221 
     | 
    
         
            +
                    puts "#{ui.color("Public IP Address", :cyan)}: #{server.public_ip_address}"
         
     | 
| 
       250 
222 
     | 
    
         
             
                    puts "#{ui.color("Private DNS Name", :cyan)}: #{server.private_dns_name}"
         
     | 
| 
       251 
223 
     | 
    
         
             
                    puts "#{ui.color("SSH Key", :cyan)}: #{server.key_name}"
         
     | 
| 
       252 
224 
     | 
    
         
             
                    puts "#{ui.color("Private IP Address", :cyan)}: #{server.private_ip_address}"
         
     | 
| 
         @@ -72,7 +72,7 @@ class Chef 
     | 
|
| 
       72 
72 
     | 
    
         
             
                      msg("Security Groups", server.groups.join(", "))
         
     | 
| 
       73 
73 
     | 
    
         
             
                      msg("SSH Key", server.key_name)
         
     | 
| 
       74 
74 
     | 
    
         
             
                      msg("Public DNS Name", server.dns_name)
         
     | 
| 
       75 
     | 
    
         
            -
                      msg("Public IP Address", server. 
     | 
| 
      
 75 
     | 
    
         
            +
                      msg("Public IP Address", server.public_ip_address)
         
     | 
| 
       76 
76 
     | 
    
         
             
                      msg("Private DNS Name", server.private_dns_name)
         
     | 
| 
       77 
77 
     | 
    
         
             
                      msg("Private IP Address", server.private_ip_address)
         
     | 
| 
       78 
78 
     | 
    
         | 
| 
         @@ -76,7 +76,8 @@ class Chef 
     | 
|
| 
       76 
76 
     | 
    
         
             
                    ]
         
     | 
| 
       77 
77 
     | 
    
         
             
                    connection.servers.all.each do |server|
         
     | 
| 
       78 
78 
     | 
    
         
             
                      server_list << server.id.to_s
         
     | 
| 
       79 
     | 
    
         
            -
                       
     | 
| 
      
 79 
     | 
    
         
            +
                      # HACK these should all be server.blah.to_s as nil.to_s == ''
         
     | 
| 
      
 80 
     | 
    
         
            +
                      server_list << (server.public_ip_address == nil ? "" : server.public_ip_address)
         
     | 
| 
       80 
81 
     | 
    
         
             
                      server_list << (server.private_ip_address == nil ? "" : server.private_ip_address)
         
     | 
| 
       81 
82 
     | 
    
         
             
                      server_list << (server.flavor_id == nil ? "" : server.flavor_id)
         
     | 
| 
       82 
83 
     | 
    
         
             
                      server_list << (server.image_id == nil ? "" : server.image_id)
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ 
     | 
|
| 
       2 
2 
     | 
    
         
             
            name: knife-openstack
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
4 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       5 
     | 
    
         
            -
              version: 0.5. 
     | 
| 
      
 5 
     | 
    
         
            +
              version: 0.5.2
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors: 
         
     | 
| 
       8 
8 
     | 
    
         
             
            - Seth Chisamore
         
     | 
| 
         @@ -10,7 +10,7 @@ autorequire: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            date: 2011-04- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2011-04-06 00:00:00 -04:00
         
     | 
| 
       14 
14 
     | 
    
         
             
            default_executable: 
         
     | 
| 
       15 
15 
     | 
    
         
             
            dependencies: 
         
     | 
| 
       16 
16 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     |