knife-joyent 0.4.1 → 0.4.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.
- checksums.yaml +4 -4
 - data/lib/chef/knife/joyent_fw_update.rb +4 -2
 - data/lib/chef/knife/joyent_image_get.rb +33 -0
 - data/lib/chef/knife/joyent_image_list.rb +11 -1
 - data/lib/knife-joyent/version.rb +1 -1
 - metadata +2 -1
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 537b18253a6c5569841cd6fb340a0c1b5898c17c
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 8158aeb00642b93a13aaa0326f88d6cfb1cecbc7
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4729dcdd8ac015f68a9faf78a8600240f0d34a8e13f88a536c23dfb0da30e86fea219608217da3f24a6bdb5902797be14806f58f95abfdf4e7efe7f0d9cbac34
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ec5427ae0f77163b05153c82b91c6f17779cdb2755a0f3847e5fb078a9e764fea3d30dab26c98333b8294ed3e763ce1ad0dd786fb0a204990bc568d277ffb113
         
     | 
| 
         @@ -11,13 +11,15 @@ class Chef 
     | 
|
| 
       11 
11 
     | 
    
         | 
| 
       12 
12 
     | 
    
         
             
                  option :rule,
         
     | 
| 
       13 
13 
     | 
    
         
             
                    :long => "--rule RULE",
         
     | 
| 
       14 
     | 
    
         
            -
                    :description => "Firewall Rule Content"
         
     | 
| 
      
 14 
     | 
    
         
            +
                    :description => "Firewall Rule Content",
         
     | 
| 
      
 15 
     | 
    
         
            +
                    :required => true
         
     | 
| 
       15 
16 
     | 
    
         | 
| 
       16 
17 
     | 
    
         
             
                  option :enabled,
         
     | 
| 
       17 
18 
     | 
    
         
             
                    :long => "--enabled",
         
     | 
| 
       18 
19 
     | 
    
         
             
                    :boolean => true,
         
     | 
| 
       19 
20 
     | 
    
         
             
                    :description => "Enable/Disable Rule"
         
     | 
| 
       20 
21 
     | 
    
         | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
       21 
23 
     | 
    
         
             
                  def run
         
     | 
| 
       22 
24 
     | 
    
         
             
                    id = name_args.first
         
     | 
| 
       23 
25 
     | 
    
         
             
                    unless id || (!config.key?(:rule) || !config.key?(:enabled))
         
     | 
| 
         @@ -39,7 +41,7 @@ class Chef 
     | 
|
| 
       39 
41 
     | 
    
         
             
                    else
         
     | 
| 
       40 
42 
     | 
    
         
             
                      r = res.body
         
     | 
| 
       41 
43 
     | 
    
         | 
| 
       42 
     | 
    
         
            -
                      ui.info " 
     | 
| 
      
 44 
     | 
    
         
            +
                      ui.info ui.color("Updated Firewall Rule: #{r["id"]}", :bold)
         
     | 
| 
       43 
45 
     | 
    
         
             
                      msg_pair "RULE", r["rule"]
         
     | 
| 
       44 
46 
     | 
    
         
             
                      msg_pair "ENABLED", (r["enabled"] ? ui.color("✓ YES", :cyan) : "✗ NO")
         
     | 
| 
       45 
47 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -0,0 +1,33 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'chef/knife/joyent_base'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            class Chef
         
     | 
| 
      
 4 
     | 
    
         
            +
              class Knife
         
     | 
| 
      
 5 
     | 
    
         
            +
                class JoyentImageGet < Knife
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
                  include Knife::JoyentBase
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  banner "knife joyent image get <image_id>"
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
                  def run
         
     | 
| 
      
 12 
     | 
    
         
            +
                    unless name_args.size === 1
         
     | 
| 
      
 13 
     | 
    
         
            +
                      show_usage
         
     | 
| 
      
 14 
     | 
    
         
            +
                      exit 1
         
     | 
| 
      
 15 
     | 
    
         
            +
                    end
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
                    id = name_args.first
         
     | 
| 
      
 18 
     | 
    
         
            +
                    # puts id
         
     | 
| 
      
 19 
     | 
    
         
            +
                    res = self.connection.request(
         
     | 
| 
      
 20 
     | 
    
         
            +
                      :method => "GET",
         
     | 
| 
      
 21 
     | 
    
         
            +
                      :path => "/my/images/#{id}"
         
     | 
| 
      
 22 
     | 
    
         
            +
                    )
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                    if res.status != 200
         
     | 
| 
      
 25 
     | 
    
         
            +
                      output_error(res)
         
     | 
| 
      
 26 
     | 
    
         
            +
                    else
         
     | 
| 
      
 27 
     | 
    
         
            +
                      r = res.body
         
     | 
| 
      
 28 
     | 
    
         
            +
                      ui.output(res.body)
         
     | 
| 
      
 29 
     | 
    
         
            +
                    end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  end
         
     | 
| 
      
 31 
     | 
    
         
            +
                end
         
     | 
| 
      
 32 
     | 
    
         
            +
              end
         
     | 
| 
      
 33 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -16,7 +16,15 @@ class Chef 
     | 
|
| 
       16 
16 
     | 
    
         
             
                  option :state,
         
     | 
| 
       17 
17 
     | 
    
         
             
                    :long => "--state <all/active/unactivated/disabled>",
         
     | 
| 
       18 
18 
     | 
    
         
             
                    :default => "active",
         
     | 
| 
       19 
     | 
    
         
            -
                    :description => "filter images by state (default: active"
         
     | 
| 
      
 19 
     | 
    
         
            +
                    :description => "filter images by state (default: active)"
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
                  option :owner,
         
     | 
| 
      
 22 
     | 
    
         
            +
                    :long => "--owner <owner_uuid>",
         
     | 
| 
      
 23 
     | 
    
         
            +
                    :description => "filter images by owner (default: none)"
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
                  option :type,
         
     | 
| 
      
 26 
     | 
    
         
            +
                    :long => "--type <smartmachine/virtualmachine>",
         
     | 
| 
      
 27 
     | 
    
         
            +
                    :description => "filter images by image type (default: all)"
         
     | 
| 
       20 
28 
     | 
    
         | 
| 
       21 
29 
     | 
    
         
             
                  def run
         
     | 
| 
       22 
30 
     | 
    
         
             
                    images = [
         
     | 
| 
         @@ -31,6 +39,8 @@ class Chef 
     | 
|
| 
       31 
39 
     | 
    
         
             
                    query = {}
         
     | 
| 
       32 
40 
     | 
    
         
             
                    query[:public] = config[:public] if config[:public]
         
     | 
| 
       33 
41 
     | 
    
         
             
                    query[:state] = config[:state] if config[:state]
         
     | 
| 
      
 42 
     | 
    
         
            +
                    query[:owner] = config[:owner] if config[:owner]
         
     | 
| 
      
 43 
     | 
    
         
            +
                    query[:type] = config[:type] if config[:type]
         
     | 
| 
       34 
44 
     | 
    
         | 
| 
       35 
45 
     | 
    
         
             
                    res = self.connection.request(
         
     | 
| 
       36 
46 
     | 
    
         
             
                      :method => "GET",
         
     | 
    
        data/lib/knife-joyent/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: knife-joyent
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Kevin Chan
         
     | 
| 
         @@ -106,6 +106,7 @@ files: 
     | 
|
| 
       106 
106 
     | 
    
         
             
            - lib/chef/knife/joyent_fw_list.rb
         
     | 
| 
       107 
107 
     | 
    
         
             
            - lib/chef/knife/joyent_fw_update.rb
         
     | 
| 
       108 
108 
     | 
    
         
             
            - lib/chef/knife/joyent_image_create.rb
         
     | 
| 
      
 109 
     | 
    
         
            +
            - lib/chef/knife/joyent_image_get.rb
         
     | 
| 
       109 
110 
     | 
    
         
             
            - lib/chef/knife/joyent_image_list.rb
         
     | 
| 
       110 
111 
     | 
    
         
             
            - lib/chef/knife/joyent_key_add.rb
         
     | 
| 
       111 
112 
     | 
    
         
             
            - lib/chef/knife/joyent_key_delete.rb
         
     |