cheffish 0.7 → 0.7.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e58ebae3c3b7856ae29da6639debd75b93d1a2ba
4
- data.tar.gz: 278ba389ad45a85bdc19dc9875c88da1084b832a
3
+ metadata.gz: ede81f8d16044c52e057959e600456f20c3a3b25
4
+ data.tar.gz: ec1c78fbef404e83ff691825949f0111e7f962ec
5
5
  SHA512:
6
- metadata.gz: 225c6e83fc286c34a7d1272a3ae53cb02b25ed3168f231ec0315772e3195f492676d011af44d846c0725d79efe2fb97f91f83d9d83207f1908427fad328910a6
7
- data.tar.gz: 165ab945e54d38c2e2173b71ac1584eab0d4b613f46c0402aa6dcc2fcb09635b3ae0d4c341d4de13493d36ab9319cc84b347a6996db53b5bc9135b33c0965ff8
6
+ metadata.gz: 9c87bd23e659677f0c3917d6bf75b153edb29abb4f00e0298daf0b15b514853452f4c876a46f55062320a05066f7ff99047514e352901502fabd0787635e106a
7
+ data.tar.gz: 46e4d256b1c534875ba01bc86a0fc7f3537fa19bd03b04f522cc022b87be6efac3d5b1568eed249745bf5c024954ccb16d32743dfed7dc6fa26908ccd0ee6619
File without changes
@@ -0,0 +1,71 @@
1
+ require 'cheffish'
2
+ require 'chef/resource/lwrp_base'
3
+ require 'chef/environment'
4
+
5
+ class Chef::Resource::ChefAcl < Chef::Resource::LWRPBase
6
+ self.resource_name = 'chef_acl'
7
+
8
+ actions :create, :delete, :nothing
9
+ default_action :create
10
+
11
+ def initialize(*args)
12
+ super
13
+ chef_server run_context.cheffish.current_chef_server
14
+ end
15
+
16
+ attribute :name, :kind_of => String, :regex => Cheffish::NAME_REGEX, :name_attribute => true
17
+ attribute :description, :kind_of => String
18
+ attribute :cookbook_versions, :kind_of => Hash, :callbacks => {
19
+ "should have valid cookbook versions" => lambda { |value| Chef::Environment.validate_cookbook_versions(value) }
20
+ }
21
+ attribute :default_attributes, :kind_of => Hash
22
+ attribute :override_attributes, :kind_of => Hash
23
+
24
+ # Specifies that this is a complete specification for the environment (i.e. attributes you don't specify will be
25
+ # reset to their defaults)
26
+ attribute :complete, :kind_of => [TrueClass, FalseClass]
27
+
28
+ attribute :raw_json, :kind_of => Hash
29
+ attribute :chef_server, :kind_of => Hash
30
+
31
+ NOT_PASSED=Object.new
32
+
33
+ # default 'ip_address', '127.0.0.1'
34
+ # default [ 'pushy', 'port' ], '9000'
35
+ # default 'ip_addresses' do |existing_value|
36
+ # (existing_value || []) + [ '127.0.0.1' ]
37
+ # end
38
+ # default 'ip_address', :delete
39
+ attr_reader :default_attribute_modifiers
40
+ def default(attribute_path, value=NOT_PASSED, &block)
41
+ @default_attribute_modifiers ||= []
42
+ if value != NOT_PASSED
43
+ @default_attribute_modifiers << [ attribute_path, value ]
44
+ elsif block
45
+ @default_attribute_modifiers << [ attribute_path, block ]
46
+ else
47
+ raise "default requires either a value or a block"
48
+ end
49
+ end
50
+
51
+ # override 'ip_address', '127.0.0.1'
52
+ # override [ 'pushy', 'port' ], '9000'
53
+ # override 'ip_addresses' do |existing_value|
54
+ # (existing_value || []) + [ '127.0.0.1' ]
55
+ # end
56
+ # override 'ip_address', :delete
57
+ attr_reader :override_attribute_modifiers
58
+ def override(attribute_path, value=NOT_PASSED, &block)
59
+ @override_attribute_modifiers ||= []
60
+ if value != NOT_PASSED
61
+ @override_attribute_modifiers << [ attribute_path, value ]
62
+ elsif block
63
+ @override_attribute_modifiers << [ attribute_path, block ]
64
+ else
65
+ raise "override requires either a value or a block"
66
+ end
67
+ end
68
+
69
+ alias :attributes :default_attributes
70
+ alias :attribute :default
71
+ end
data/lib/cheffish.rb CHANGED
@@ -64,12 +64,18 @@ module Cheffish
64
64
  if Chef::Config.local_mode && !Chef::Config.has_key?(:cookbook_path) && !Chef::Config.has_key?(:chef_repo_path)
65
65
  Chef::Config.chef_repo_path = Chef::Config.find_chef_repo_path(Dir.pwd)
66
66
  end
67
- Chef::Application.setup_server_connectivity
68
- if block_given?
69
- begin
70
- yield
71
- ensure
72
- Chef::Application.destroy_server_connectivity
67
+ begin
68
+ require 'chef/local_mode'
69
+ Chef::LocalMode.with_server_connectivity(&block)
70
+
71
+ rescue LoadError
72
+ Chef::Application.setup_server_connectivity
73
+ if block_given?
74
+ begin
75
+ yield
76
+ ensure
77
+ Chef::Application.destroy_server_connectivity
78
+ end
73
79
  end
74
80
  end
75
81
  end
@@ -1,3 +1,3 @@
1
1
  module Cheffish
2
- VERSION = '0.7'
2
+ VERSION = '0.7.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheffish
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.7'
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-15 00:00:00.000000000 Z
11
+ date: 2014-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -77,6 +77,7 @@ files:
77
77
  - LICENSE
78
78
  - README.md
79
79
  - Rakefile
80
+ - lib/chef/provider/chef_acl.rb
80
81
  - lib/chef/provider/chef_client.rb
81
82
  - lib/chef/provider/chef_data_bag.rb
82
83
  - lib/chef/provider/chef_data_bag_item.rb
@@ -87,6 +88,7 @@ files:
87
88
  - lib/chef/provider/chef_user.rb
88
89
  - lib/chef/provider/private_key.rb
89
90
  - lib/chef/provider/public_key.rb
91
+ - lib/chef/resource/chef_acl.rb
90
92
  - lib/chef/resource/chef_client.rb
91
93
  - lib/chef/resource/chef_data_bag.rb
92
94
  - lib/chef/resource/chef_data_bag_item.rb