knife-essentials 0.9.2 → 0.9.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/lib/chef/knife/raw_essentials.rb +3 -61
- data/lib/chef_fs/data_handler/data_handler_base.rb +2 -1
- data/lib/chef_fs/file_system/base_fs_object.rb +75 -1
- data/lib/chef_fs/file_system/chef_repository_file_system_entry.rb +23 -0
- data/lib/chef_fs/file_system/cookbook_dir.rb +27 -13
- data/lib/chef_fs/file_system/cookbooks_dir.rb +89 -30
- data/lib/chef_fs/file_system/data_bags_dir.rb +5 -1
- data/lib/chef_fs/file_system/nodes_dir.rb +8 -14
- data/lib/chef_fs/file_system/rest_list_dir.rb +6 -2
- data/lib/chef_fs/file_system/rest_list_entry.rb +15 -3
- data/lib/chef_fs/knife.rb +28 -17
- data/lib/chef_fs/version.rb +1 -1
- data/spec/chef_fs/file_system/chef_server_root_dir_spec.rb +26 -12
- data/spec/chef_fs/file_system/cookbook_dir_spec.rb +582 -0
- data/spec/chef_fs/file_system/cookbooks_dir_spec.rb +81 -489
- data/spec/chef_fs/file_system/data_bags_dir_spec.rb +63 -49
- data/spec/integration/deps_spec.rb +32 -32
- data/spec/integration/diff_spec.rb +425 -133
- data/spec/integration/download_spec.rb +743 -211
- data/spec/integration/upload_spec.rb +814 -244
- data/spec/support/integration_helper.rb +33 -6
- data/spec/support/knife_support.rb +4 -2
- metadata +19 -2
@@ -1,6 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# Author:: John Keiser (<jkeiser@opscode.com>)
|
3
|
-
#
|
3
|
+
# Author:: Ho-Sheng Hsiao (<hosh@opscode.com>)
|
4
|
+
# Copyright:: Copyright (c) 2012, 2013 Opscode, Inc.
|
4
5
|
# License:: Apache License, Version 2.0
|
5
6
|
#
|
6
7
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
@@ -27,6 +28,8 @@ require 'support/spec_helper'
|
|
27
28
|
module IntegrationSupport
|
28
29
|
include ChefZero::RSpec
|
29
30
|
|
31
|
+
# Integration DSL
|
32
|
+
|
30
33
|
def when_the_repository(description, *args, &block)
|
31
34
|
context "When the local repository #{description}", *args do
|
32
35
|
before :each do
|
@@ -70,11 +73,15 @@ module IntegrationSupport
|
|
70
73
|
dir = File.dirname(filename)
|
71
74
|
FileUtils.mkdir_p(dir) unless dir == '.'
|
72
75
|
File.open(filename, 'w') do |file|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
76
|
+
raw = case contents
|
77
|
+
when Hash
|
78
|
+
JSON.pretty_generate(contents)
|
79
|
+
when Array
|
80
|
+
contents.join("\n")
|
81
|
+
else
|
82
|
+
contents
|
83
|
+
end
|
84
|
+
file.write(raw)
|
78
85
|
end
|
79
86
|
end
|
80
87
|
|
@@ -125,4 +132,24 @@ module IntegrationSupport
|
|
125
132
|
instance_eval(&block)
|
126
133
|
end
|
127
134
|
end
|
135
|
+
|
136
|
+
# Versioned cookbooks
|
137
|
+
|
138
|
+
def with_versioned_cookbooks(_metadata = {}, &block)
|
139
|
+
_m = { :versioned_cookbooks => true }.merge(_metadata)
|
140
|
+
context 'with versioned cookbooks', _m do
|
141
|
+
before(:each) { Chef::Config[:versioned_cookbooks] = true }
|
142
|
+
after(:each) { Chef::Config[:versioned_cookbooks] = false }
|
143
|
+
instance_eval(&block)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
def without_versioned_cookbooks(_metadata = {}, &block)
|
148
|
+
_m = { :versioned_cookbooks => false }.merge(_metadata)
|
149
|
+
context 'with versioned cookbooks', _m do
|
150
|
+
# Just make sure this goes back to default
|
151
|
+
before(:each) { Chef::Config[:versioned_cookbooks] = false }
|
152
|
+
instance_eval(&block)
|
153
|
+
end
|
154
|
+
end
|
128
155
|
end
|
@@ -4,6 +4,7 @@ require 'logger'
|
|
4
4
|
require 'chef/log'
|
5
5
|
|
6
6
|
module KnifeSupport
|
7
|
+
DEBUG = ENV['DEBUG']
|
7
8
|
def knife(*args, &block)
|
8
9
|
# Allow knife('role from file roles/blah.json') rather than requiring the
|
9
10
|
# arguments to be split like knife('role', 'from', 'file', 'roles/blah.json')
|
@@ -21,6 +22,7 @@ module KnifeSupport
|
|
21
22
|
old_loggers = Chef::Log.loggers
|
22
23
|
old_log_level = Chef::Log.level
|
23
24
|
begin
|
25
|
+
puts "knife: #{args.join(' ')}" if DEBUG
|
24
26
|
subcommand_class = Chef::Knife.subcommand_class_from(args)
|
25
27
|
subcommand_class.options = Chef::Application::Knife.options.merge(subcommand_class.options)
|
26
28
|
instance = subcommand_class.new(args)
|
@@ -29,12 +31,12 @@ module KnifeSupport
|
|
29
31
|
instance.ui = Chef::Knife::UI.new(stdout, stderr, STDIN, {})
|
30
32
|
|
31
33
|
# Don't print stuff
|
32
|
-
Chef::Config[:verbosity] = 0
|
34
|
+
Chef::Config[:verbosity] = ( DEBUG ? 2 : 0 )
|
33
35
|
instance.configure_chef
|
34
36
|
logger = Logger.new(stderr)
|
35
37
|
logger.formatter = proc { |severity, datetime, progname, msg| "#{severity}: #{msg}\n" }
|
36
38
|
Chef::Log.use_log_devices([logger])
|
37
|
-
Chef::Log.level = :warn
|
39
|
+
Chef::Log.level = ( DEBUG ? :debug : :warn )
|
38
40
|
Chef::Log::Formatter.show_time = false
|
39
41
|
instance.run
|
40
42
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-essentials
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: chef-zero
|
@@ -27,6 +27,22 @@ dependencies:
|
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: rspec
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :development
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
30
46
|
description: Universal knife verbs that work with your Chef repository
|
31
47
|
email: jkeiser@opscode.com
|
32
48
|
executables: []
|
@@ -92,6 +108,7 @@ files:
|
|
92
108
|
- spec/chef_fs/diff_spec.rb
|
93
109
|
- spec/chef_fs/file_pattern_spec.rb
|
94
110
|
- spec/chef_fs/file_system/chef_server_root_dir_spec.rb
|
111
|
+
- spec/chef_fs/file_system/cookbook_dir_spec.rb
|
95
112
|
- spec/chef_fs/file_system/cookbooks_dir_spec.rb
|
96
113
|
- spec/chef_fs/file_system/data_bags_dir_spec.rb
|
97
114
|
- spec/chef_fs/file_system_spec.rb
|