from-scratch 0.3.0 → 0.5.0

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.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Berksfile +2 -1
  3. data/Berksfile.lock +20 -1
  4. data/cookbooks/bluepill/CHANGELOG.md +93 -0
  5. data/cookbooks/bluepill/README.md +91 -0
  6. data/cookbooks/bluepill/attributes/default.rb +44 -0
  7. data/cookbooks/bluepill/metadata.json +1 -0
  8. data/cookbooks/bluepill/providers/service.rb +172 -0
  9. data/cookbooks/bluepill/recipes/default.rb +48 -0
  10. data/cookbooks/bluepill/recipes/rsyslog.rb +28 -0
  11. data/cookbooks/bluepill/resources/service.rb +27 -0
  12. data/cookbooks/bluepill/templates/default/bluepill_init.fedora.erb +34 -0
  13. data/cookbooks/bluepill/templates/default/bluepill_init.freebsd.erb +32 -0
  14. data/cookbooks/bluepill/templates/default/bluepill_init.lsb.erb +37 -0
  15. data/cookbooks/bluepill/templates/default/bluepill_init.rhel.erb +34 -0
  16. data/cookbooks/bluepill/templates/default/bluepill_rsyslog.conf.erb +1 -0
  17. data/cookbooks/nginx/CHANGELOG.md +435 -0
  18. data/cookbooks/nginx/README.md +521 -0
  19. data/cookbooks/nginx/attributes/auth_request.rb +23 -0
  20. data/cookbooks/nginx/attributes/default.rb +131 -0
  21. data/cookbooks/nginx/attributes/devel.rb +24 -0
  22. data/cookbooks/nginx/attributes/echo.rb +24 -0
  23. data/cookbooks/nginx/attributes/geoip.rb +31 -0
  24. data/cookbooks/nginx/attributes/headers_more.rb +24 -0
  25. data/cookbooks/nginx/attributes/lua.rb +28 -0
  26. data/cookbooks/nginx/attributes/naxsi.rb +24 -0
  27. data/cookbooks/nginx/attributes/openssl_source.rb +23 -0
  28. data/cookbooks/nginx/attributes/pagespeed.rb +9 -0
  29. data/cookbooks/nginx/attributes/passenger.rb +58 -0
  30. data/cookbooks/nginx/attributes/rate_limiting.rb +23 -0
  31. data/cookbooks/nginx/attributes/repo.rb +35 -0
  32. data/cookbooks/nginx/attributes/set_misc.rb +8 -0
  33. data/cookbooks/nginx/attributes/socketproxy.rb +13 -0
  34. data/cookbooks/nginx/attributes/source.rb +42 -0
  35. data/cookbooks/nginx/attributes/status.rb +22 -0
  36. data/cookbooks/nginx/attributes/syslog.rb +24 -0
  37. data/cookbooks/nginx/attributes/upload_progress.rb +26 -0
  38. data/cookbooks/nginx/definitions/nginx_site.rb +50 -0
  39. data/cookbooks/nginx/files/default/mime.types +78 -0
  40. data/cookbooks/nginx/files/default/naxsi_core.rules +82 -0
  41. data/cookbooks/nginx/libraries/matchers.rb +20 -0
  42. data/cookbooks/nginx/metadata.json +351 -0
  43. data/cookbooks/nginx/recipes/authorized_ips.rb +32 -0
  44. data/cookbooks/nginx/recipes/commons.rb +24 -0
  45. data/cookbooks/nginx/recipes/commons_conf.rb +42 -0
  46. data/cookbooks/nginx/recipes/commons_dir.rb +57 -0
  47. data/cookbooks/nginx/recipes/commons_script.rb +29 -0
  48. data/cookbooks/nginx/recipes/default.rb +31 -0
  49. data/cookbooks/nginx/recipes/headers_more_module.rb +50 -0
  50. data/cookbooks/nginx/recipes/http_auth_request_module.rb +52 -0
  51. data/cookbooks/nginx/recipes/http_echo_module.rb +46 -0
  52. data/cookbooks/nginx/recipes/http_geoip_module.rb +113 -0
  53. data/cookbooks/nginx/recipes/http_gzip_static_module.rb +30 -0
  54. data/cookbooks/nginx/recipes/http_mp4_module.rb +2 -0
  55. data/cookbooks/nginx/recipes/http_perl_module.rb +23 -0
  56. data/cookbooks/nginx/recipes/http_realip_module.rb +38 -0
  57. data/cookbooks/nginx/recipes/http_spdy_module.rb +23 -0
  58. data/cookbooks/nginx/recipes/http_ssl_module.rb +23 -0
  59. data/cookbooks/nginx/recipes/http_stub_status_module.rb +36 -0
  60. data/cookbooks/nginx/recipes/ipv6.rb +23 -0
  61. data/cookbooks/nginx/recipes/lua.rb +47 -0
  62. data/cookbooks/nginx/recipes/naxsi_module.rb +52 -0
  63. data/cookbooks/nginx/recipes/ngx_devel_module.rb +44 -0
  64. data/cookbooks/nginx/recipes/ngx_lua_module.rb +47 -0
  65. data/cookbooks/nginx/recipes/ohai_plugin.rb +35 -0
  66. data/cookbooks/nginx/recipes/openssl_source.rb +45 -0
  67. data/cookbooks/nginx/recipes/package.rb +52 -0
  68. data/cookbooks/nginx/recipes/pagespeed_module.rb +62 -0
  69. data/cookbooks/nginx/recipes/passenger.rb +56 -0
  70. data/cookbooks/nginx/recipes/repo.rb +41 -0
  71. data/cookbooks/nginx/recipes/repo_passenger.rb +39 -0
  72. data/cookbooks/nginx/recipes/set_misc.rb +30 -0
  73. data/cookbooks/nginx/recipes/socketproxy.rb +26 -0
  74. data/cookbooks/nginx/recipes/source.rb +205 -0
  75. data/cookbooks/nginx/recipes/syslog_module.rb +69 -0
  76. data/cookbooks/nginx/recipes/upload_progress_module.rb +53 -0
  77. data/cookbooks/nginx/templates/debian/nginx.init.erb +97 -0
  78. data/cookbooks/nginx/templates/default/default-site.erb +11 -0
  79. data/cookbooks/nginx/templates/default/modules/authorized_ip.erb +6 -0
  80. data/cookbooks/nginx/templates/default/modules/http_geoip.conf.erb +4 -0
  81. data/cookbooks/nginx/templates/default/modules/http_gzip_static.conf.erb +1 -0
  82. data/cookbooks/nginx/templates/default/modules/http_realip.conf.erb +7 -0
  83. data/cookbooks/nginx/templates/default/modules/nginx_status.erb +14 -0
  84. data/cookbooks/nginx/templates/default/modules/passenger.conf.erb +13 -0
  85. data/cookbooks/nginx/templates/default/modules/socketproxy.conf.erb +89 -0
  86. data/cookbooks/nginx/templates/default/modules/upload_progress.erb +4 -0
  87. data/cookbooks/nginx/templates/default/nginx-upstart.conf.erb +39 -0
  88. data/cookbooks/nginx/templates/default/nginx.conf.erb +103 -0
  89. data/cookbooks/nginx/templates/default/nginx.init.erb +111 -0
  90. data/cookbooks/nginx/templates/default/nginx.pill.erb +15 -0
  91. data/cookbooks/nginx/templates/default/nginx.sysconfig.erb +1 -0
  92. data/cookbooks/nginx/templates/default/nxdissite.erb +29 -0
  93. data/cookbooks/nginx/templates/default/nxensite.erb +38 -0
  94. data/cookbooks/nginx/templates/default/plugins/nginx.rb.erb +66 -0
  95. data/cookbooks/nginx/templates/default/sv-nginx-log-run.erb +2 -0
  96. data/cookbooks/nginx/templates/default/sv-nginx-run.erb +4 -0
  97. data/cookbooks/nginx/templates/gentoo/nginx.init.erb +87 -0
  98. data/cookbooks/nginx/templates/suse/nginx.init.erb +115 -0
  99. data/cookbooks/nginx/templates/ubuntu/nginx.init.erb +97 -0
  100. data/cookbooks/ohai/CHANGELOG.md +69 -0
  101. data/cookbooks/ohai/README.md +89 -0
  102. data/cookbooks/ohai/attributes/default.rb +31 -0
  103. data/cookbooks/ohai/files/default/plugins/README +1 -0
  104. data/cookbooks/ohai/libraries/matchers.rb +14 -0
  105. data/cookbooks/ohai/metadata.json +1 -0
  106. data/cookbooks/ohai/providers/hint.rb +38 -0
  107. data/cookbooks/ohai/recipes/default.rb +52 -0
  108. data/cookbooks/ohai/resources/hint.rb +5 -0
  109. data/cookbooks/packagecloud/CHANGELOG.md +12 -0
  110. data/cookbooks/packagecloud/README.md +80 -0
  111. data/cookbooks/packagecloud/attributes/default.rb +8 -0
  112. data/cookbooks/packagecloud/libraries/helper.rb +43 -0
  113. data/cookbooks/packagecloud/libraries/matcher.rb +7 -0
  114. data/cookbooks/packagecloud/metadata.json +1 -0
  115. data/cookbooks/packagecloud/providers/repo.rb +212 -0
  116. data/cookbooks/packagecloud/resources/repo.rb +10 -0
  117. data/cookbooks/packagecloud/templates/.kitchen/logs/kitchen.log +29 -0
  118. data/cookbooks/packagecloud/templates/default/apt.erb +2 -0
  119. data/cookbooks/packagecloud/templates/default/yum.erb +15 -0
  120. data/cookbooks/rsyslog/CHANGELOG.md +193 -0
  121. data/cookbooks/rsyslog/README.md +276 -0
  122. data/cookbooks/rsyslog/attributes/default.rb +131 -0
  123. data/cookbooks/rsyslog/libraries/helpers.rb +25 -0
  124. data/cookbooks/rsyslog/metadata.json +1 -0
  125. data/cookbooks/rsyslog/providers/file_input.rb +44 -0
  126. data/cookbooks/rsyslog/recipes/client.rb +87 -0
  127. data/cookbooks/rsyslog/recipes/default.rb +89 -0
  128. data/cookbooks/rsyslog/recipes/server.rb +44 -0
  129. data/cookbooks/rsyslog/resources/file_input.rb +28 -0
  130. data/cookbooks/rsyslog/templates/default/35-server-per-host.conf.erb +62 -0
  131. data/cookbooks/rsyslog/templates/default/49-relp.conf.erb +10 -0
  132. data/cookbooks/rsyslog/templates/default/49-remote.conf.erb +30 -0
  133. data/cookbooks/rsyslog/templates/default/50-default.conf.erb +6 -0
  134. data/cookbooks/rsyslog/templates/default/file-input.conf.erb +15 -0
  135. data/cookbooks/rsyslog/templates/default/omnios-manifest.xml.erb +30 -0
  136. data/cookbooks/rsyslog/templates/default/rsyslog.conf.erb +117 -0
  137. data/cookbooks/rsyslog/templates/smartos/50-default.conf.erb +18 -0
  138. data/cookbooks/runit/.kitchen.cloud.yml +103 -0
  139. data/cookbooks/runit/.kitchen.yml +38 -0
  140. data/cookbooks/runit/.rspec +3 -0
  141. data/cookbooks/runit/.rubocop.yml +45 -0
  142. data/cookbooks/runit/Berksfile.disabled +11 -0
  143. data/cookbooks/runit/CHANGELOG.md +226 -0
  144. data/cookbooks/runit/CONTRIBUTING.md +266 -0
  145. data/cookbooks/runit/Cheffile +11 -0
  146. data/cookbooks/runit/Gemfile +17 -0
  147. data/cookbooks/runit/LICENSE +201 -0
  148. data/cookbooks/runit/README.md +435 -0
  149. data/cookbooks/runit/Rakefile +23 -0
  150. data/cookbooks/runit/TESTING.md +26 -0
  151. data/cookbooks/runit/attributes/default.rb +62 -0
  152. data/cookbooks/runit/files/default/runit.seed +1 -0
  153. data/cookbooks/runit/files/default/runsvdir +0 -0
  154. data/cookbooks/runit/files/ubuntu-6.10/runsvdir +6 -0
  155. data/cookbooks/runit/files/ubuntu-7.04/runsvdir +7 -0
  156. data/cookbooks/runit/files/ubuntu-7.10/runsvdir +7 -0
  157. data/cookbooks/runit/files/ubuntu-8.04/runsvdir +7 -0
  158. data/cookbooks/runit/libraries/default.rb +0 -0
  159. data/cookbooks/runit/libraries/helpers.rb +190 -0
  160. data/cookbooks/runit/libraries/matchers.rb +69 -0
  161. data/cookbooks/runit/libraries/provider_runit_service.rb +326 -0
  162. data/cookbooks/runit/libraries/resource_runit_service.rb +267 -0
  163. data/cookbooks/runit/metadata.json +50 -0
  164. data/cookbooks/runit/recipes/default.rb +91 -0
  165. data/cookbooks/runit/templates/debian/init.d.erb +66 -0
  166. data/cookbooks/runit/templates/default/log-config.erb +24 -0
  167. data/cookbooks/runit/templates/gentoo/runit-start.sh.erb +32 -0
  168. data/cookbooks/scratchify/Berksfile +2 -1
  169. data/cookbooks/scratchify/Berksfile.lock +20 -1
  170. data/cookbooks/scratchify/lib/from-scratch.rb +1 -4
  171. data/cookbooks/scratchify/lib/from-scratch/version.rb +1 -1
  172. data/cookbooks/scratchify/metadata.json +5 -2
  173. data/cookbooks/scratchify/recipes/default.rb +15 -1
  174. data/cookbooks/scratchify/recipes/nginx_site.rb +4 -0
  175. data/cookbooks/scratchify/recipes/pre_rvm.rb +5 -0
  176. data/cookbooks/scratchify/templates/nginx.erb +31 -0
  177. data/cookbooks/scratchify/templates/node.json.erb +21 -6
  178. data/cookbooks/yum-epel/CHANGELOG.md +84 -0
  179. data/cookbooks/yum-epel/README.md +172 -0
  180. data/cookbooks/yum-epel/attributes/default.rb +1 -0
  181. data/cookbooks/yum-epel/attributes/epel-debuginfo.rb +28 -0
  182. data/cookbooks/yum-epel/attributes/epel-source.rb +28 -0
  183. data/cookbooks/yum-epel/attributes/epel-testing-debuginfo.rb +28 -0
  184. data/cookbooks/yum-epel/attributes/epel-testing-source.rb +28 -0
  185. data/cookbooks/yum-epel/attributes/epel-testing.rb +28 -0
  186. data/cookbooks/yum-epel/attributes/epel.rb +28 -0
  187. data/cookbooks/yum-epel/metadata.json +1 -0
  188. data/cookbooks/yum-epel/recipes/default.rb +61 -0
  189. data/cookbooks/yum/CHANGELOG.md +294 -0
  190. data/cookbooks/yum/README.md +285 -0
  191. data/cookbooks/yum/attributes/main.rb +100 -0
  192. data/cookbooks/yum/libraries/matchers.rb +27 -0
  193. data/cookbooks/yum/metadata.json +1 -0
  194. data/cookbooks/yum/providers/globalconfig.rb +41 -0
  195. data/cookbooks/yum/providers/repository.rb +106 -0
  196. data/cookbooks/yum/recipes/default.rb +26 -0
  197. data/cookbooks/yum/resources/globalconfig.rb +109 -0
  198. data/cookbooks/yum/resources/repository.rb +69 -0
  199. data/cookbooks/yum/templates/default/main.erb +276 -0
  200. data/cookbooks/yum/templates/default/repo.erb +125 -0
  201. data/lib/from-scratch.rb +1 -0
  202. data/lib/from-scratch/version.rb +1 -1
  203. data/metadata.rb +5 -1
  204. data/recipes/default.rb +15 -1
  205. data/recipes/nginx_site.rb +4 -0
  206. data/recipes/pre_rvm.rb +5 -0
  207. data/templates/nginx.erb +31 -0
  208. data/templates/node.json.erb +21 -6
  209. metadata +194 -1
@@ -0,0 +1,8 @@
1
+ default['packagecloud']['base_repo_path'] = "/install/repositories/"
2
+ default['packagecloud']['gpg_key_path'] = "/gpg.key"
3
+ default['packagecloud']['hostname_override'] = nil
4
+
5
+ default['packagecloud']['default_type'] = value_for_platform_family(
6
+ 'debian' => 'deb',
7
+ ['rhel', 'fedora'] => 'rpm'
8
+ )
@@ -0,0 +1,43 @@
1
+ require 'net/https'
2
+
3
+ module PackageCloud
4
+ module Helper
5
+ def get(uri, params)
6
+ uri.query = URI.encode_www_form(params)
7
+ req = Net::HTTP::Get.new(uri.request_uri)
8
+
9
+ req.basic_auth uri.user, uri.password if uri.user
10
+
11
+ http = Net::HTTP.new(uri.hostname, uri.port)
12
+ http.use_ssl = true
13
+
14
+ resp = http.start { |h| h.request(req) }
15
+
16
+ case resp
17
+ when Net::HTTPSuccess
18
+ resp
19
+ else
20
+ raise resp.inspect
21
+ end
22
+ end
23
+
24
+ def post(uri, params)
25
+ req = Net::HTTP::Post.new(uri.request_uri)
26
+ req.form_data = params
27
+
28
+ req.basic_auth uri.user, uri.password if uri.user
29
+
30
+ http = Net::HTTP.new(uri.hostname, uri.port)
31
+ http.use_ssl = true
32
+
33
+ resp = http.start { |h| h.request(req) }
34
+
35
+ case resp
36
+ when Net::HTTPSuccess
37
+ resp
38
+ else
39
+ raise resp.inspect
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,7 @@
1
+ if defined?(ChefSpec)
2
+
3
+ def create_packagecloud_repo(resource_name)
4
+ ChefSpec::Matchers::ResourceMatcher.new(:packagecloud_repo, :add, resource_name)
5
+ end
6
+
7
+ end
@@ -0,0 +1 @@
1
+ {"name":"packagecloud","version":"0.1.0","description":"Installs/Configures packagecloud.io repositories.","long_description":"Installs/Configures packagecloud.io repositories.","maintainer":"Joe Damato","maintainer_email":"joe@packagecloud.io","license":"Apache 2.0","platforms":{},"dependencies":{},"recommendations":{},"suggestions":{},"conflicting":{},"providing":{},"replacing":{},"attributes":{},"groupings":{},"recipes":{}}
@@ -0,0 +1,212 @@
1
+ include ::PackageCloud::Helper
2
+
3
+ require 'uri'
4
+
5
+ use_inline_resources if defined?(use_inline_resources)
6
+
7
+ action :add do
8
+ case new_resource.type
9
+ when 'deb'
10
+ install_deb
11
+ when 'rpm'
12
+ install_rpm
13
+ when 'gem'
14
+ install_gem
15
+ else
16
+ raise "#{new_resource.type} is an unknown package type."
17
+ end
18
+ end
19
+
20
+ def install_deb
21
+ base_url = new_resource.base_url
22
+ repo_url = construct_uri_with_options({base_url: base_url, repo: new_resource.repository, endpoint: node['platform']})
23
+
24
+ Chef::Log.debug("#{new_resource.name} deb repo url = #{repo_url}")
25
+
26
+ package 'apt-transport-https'
27
+
28
+ template "/etc/apt/sources.list.d/#{filename}.list" do
29
+ source 'apt.erb'
30
+ cookbook 'packagecloud'
31
+ mode '0644'
32
+ variables :base_url => read_token(repo_url).to_s,
33
+ :distribution => node['lsb']['codename'],
34
+ :component => 'main'
35
+
36
+ notifies :run, "execute[apt-key-add-#{filename}]", :immediately
37
+ notifies :run, "execute[apt-get-update-#{filename}]", :immediately
38
+ end
39
+
40
+ gpg_key_url = ::File.join(base_url, node['packagecloud']['gpg_key_path'])
41
+
42
+ execute "apt-key-add-#{filename}" do
43
+ command "wget -qO - #{gpg_key_url} | apt-key add -"
44
+ action :nothing
45
+ end
46
+
47
+ execute "apt-get-update-#{filename}" do
48
+ command "apt-get update -o Dir::Etc::sourcelist=\"sources.list.d/#{filename}.list\"" \
49
+ " -o Dir::Etc::sourceparts=\"-\"" \
50
+ " -o APT::Get::List-Cleanup=\"0\""
51
+ action :nothing
52
+ end
53
+ end
54
+
55
+ def install_rpm
56
+ given_base_url = new_resource.base_url
57
+
58
+ base_repo_url = ::File.join(given_base_url, node['packagecloud']['base_repo_path'])
59
+
60
+ base_url_endpoint = construct_uri_with_options({base_url: base_repo_url, repo: new_resource.repository, endpoint: 'rpm_base_url'})
61
+
62
+ gpg_filename = URI.parse(base_repo_url).host.gsub!('.', '_')
63
+
64
+ if new_resource.master_token
65
+ base_url_endpoint.user = new_resource.master_token
66
+ base_url_endpoint.password = ''
67
+ end
68
+
69
+ base_url = URI(get(base_url_endpoint, install_endpoint_params).body.chomp)
70
+
71
+ Chef::Log.debug("#{new_resource.name} rpm base url = #{base_url}")
72
+
73
+ package 'pygpgme' do
74
+ ignore_failure true
75
+ end
76
+
77
+ log 'pygpgme_warning' do
78
+ message 'The pygpgme package could not be installed. This means GPG verification is not possible for any RPM installed on your system. ' \
79
+ 'To fix this, add a repository with pygpgme. Usualy, the EPEL repository for your system will have this. ' \
80
+ 'More information: https://fedoraproject.org/wiki/EPEL#How_can_I_use_these_extra_packages.3F and https://github.com/opscode-cookbooks/yum-epel'
81
+
82
+ level :warn
83
+ not_if 'rpm -qa | grep -qw pygpgme'
84
+ end
85
+
86
+ ruby_block 'disable repo_gpgcheck if no pygpgme' do
87
+ block do
88
+ template = run_context.resource_collection.find(:template => "/etc/yum.repos.d/#{filename}.repo")
89
+ template.variables[:repo_gpgcheck] = 0
90
+ end
91
+ not_if 'rpm -qa | grep -qw pygpgme'
92
+ end
93
+
94
+ remote_file "/etc/pki/rpm-gpg/RPM-GPG-KEY-#{gpg_filename}" do
95
+ source ::File.join(given_base_url, node['packagecloud']['gpg_key_path'])
96
+ mode '0644'
97
+ end
98
+
99
+ template "/etc/yum.repos.d/#{filename}.repo" do
100
+ source 'yum.erb'
101
+ cookbook 'packagecloud'
102
+ mode '0644'
103
+ variables :base_url => read_token(base_url).to_s,
104
+ :gpg_filename => gpg_filename,
105
+ :name => filename,
106
+ :repo_gpgcheck => 1,
107
+ :description => filename,
108
+ :priority => new_resource.priority,
109
+ :metadata_expire => new_resource.metadata_expire
110
+
111
+ notifies :run, "execute[yum-makecache-#{filename}]", :immediately
112
+ notifies :create, "ruby_block[yum-cache-reload-#{filename}]", :immediately
113
+ end
114
+
115
+ # get the metadata for this repo only
116
+ execute "yum-makecache-#{filename}" do
117
+ command "yum -q makecache -y --disablerepo=* --enablerepo=#{filename}"
118
+ action :nothing
119
+ end
120
+
121
+ # reload internal Chef yum cache
122
+ ruby_block "yum-cache-reload-#{filename}" do
123
+ block { Chef::Provider::Package::Yum::YumCache.instance.reload }
124
+ action :nothing
125
+ end
126
+ end
127
+
128
+ def install_gem
129
+ base_url = new_resource.base_url
130
+
131
+ repo_url = construct_uri_with_options({base_url: base_url, repo: new_resource.repository})
132
+ repo_url = read_token(repo_url, true).to_s
133
+
134
+
135
+ execute "install packagecloud #{new_resource.name} repo as gem source" do
136
+ command "gem source --add #{repo_url}"
137
+ not_if "gem source --list | grep #{repo_url}"
138
+ end
139
+ end
140
+
141
+
142
+ def read_token(repo_url, gems=false)
143
+ return repo_url unless new_resource.master_token
144
+
145
+ base_url = new_resource.base_url
146
+
147
+ base_repo_url = ::File.join(base_url, node['packagecloud']['base_repo_path'])
148
+
149
+ uri = construct_uri_with_options({base_url: base_repo_url, repo: new_resource.repository, endpoint: 'tokens.text'})
150
+ uri.user = new_resource.master_token
151
+ uri.password = ''
152
+
153
+ resp = post(uri, install_endpoint_params)
154
+
155
+ Chef::Log.debug("#{new_resource.name} TOKEN = #{resp.body.chomp}")
156
+
157
+ if is_rhel5? && !gems
158
+ repo_url
159
+ else
160
+ repo_url.user = resp.body.chomp
161
+ repo_url.password = ''
162
+ repo_url
163
+ end
164
+ end
165
+
166
+ def install_endpoint_params
167
+ dist = value_for_platform_family(
168
+ 'debian' => node['lsb']['codename'],
169
+ ['rhel', 'fedora'] => node['platform_version'],
170
+ )
171
+
172
+ hostname = node['packagecloud']['hostname_override'] ||
173
+ node['fqdn'] ||
174
+ node['hostname']
175
+
176
+ if !hostname
177
+ raise("Can't determine hostname! Set node['packagecloud']['hostname_override'] " \
178
+ "if it cannot be automatically determined by Ohai.")
179
+ end
180
+
181
+ { :os => node['platform'],
182
+ :dist => dist,
183
+ :name => hostname }
184
+ end
185
+
186
+ def filename
187
+ new_resource.name.gsub(/[^0-9A-z.\-]/, '_')
188
+ end
189
+
190
+ def is_rhel5?
191
+ platform_family?('rhel') && node['platform_version'].to_i == 5
192
+ end
193
+
194
+ def construct_uri_with_options(options)
195
+ required_options = [:base_url, :repo]
196
+
197
+ required_options.each do |opt|
198
+ if !options[opt]
199
+ raise ArgumentError,
200
+ "A required option :#{opt} was not specified"
201
+ end
202
+ end
203
+
204
+ options[:base_url] = append_trailing_slash(options[:base_url])
205
+ options[:repo] = append_trailing_slash(options[:repo])
206
+
207
+ URI.join(options.delete(:base_url), options.inject([]) {|mem, opt| mem << opt[1]}.join)
208
+ end
209
+
210
+ def append_trailing_slash(str)
211
+ str.end_with?("/") ? str : str + "/"
212
+ end
@@ -0,0 +1,10 @@
1
+ actions :add
2
+ default_action :add
3
+
4
+ attribute :repository, :kind_of => String, :name_attribute => true
5
+ attribute :master_token, :kind_of => String
6
+ attribute :type, :kind_of => String, :equal_to => ['deb', 'rpm', 'gem'], :default => node['packagecloud']['default_type']
7
+ attribute :base_url, :kind_of => String, :default => "https://packagecloud.io"
8
+ attribute :gpg_key_url, :kind_of => String, :default => node['packagecloud']['gpg_key_url']
9
+ attribute :priority, :kind_of => [Fixnum, TrueClass, FalseClass], :default => false
10
+ attribute :metadata_expire, :kind_of => String, :regex => [/^\d+[d|h|m]?$/], :default => nil
@@ -0,0 +1,29 @@
1
+ I, [2014-10-14T14:05:34.449954 #11620] INFO -- Kitchen: -----> Starting Kitchen (v1.2.1)
2
+ E, [2014-10-14T14:05:34.450470 #11620] ERROR -- Kitchen: ------Exception-------
3
+ E, [2014-10-14T14:05:34.450533 #11620] ERROR -- Kitchen: Class: Kitchen::UserError
4
+ E, [2014-10-14T14:05:34.450587 #11620] ERROR -- Kitchen: Message: Kitchen YAML file /Users/joe/code/packagecloud/templates/.kitchen.yml does not exist.
5
+ E, [2014-10-14T14:05:34.450645 #11620] ERROR -- Kitchen: ------Backtrace-------
6
+ E, [2014-10-14T14:05:34.450685 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/loader/yaml.rb:74:in `read'
7
+ E, [2014-10-14T14:05:34.450711 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/config.rb:78:in `data'
8
+ E, [2014-10-14T14:05:34.450735 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/config.rb:66:in `suites'
9
+ E, [2014-10-14T14:05:34.450829 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/config.rb:90:in `filter_instances'
10
+ E, [2014-10-14T14:05:34.450853 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/config.rb:72:in `build_instances'
11
+ E, [2014-10-14T14:05:34.450875 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/config.rb:52:in `instances'
12
+ E, [2014-10-14T14:05:34.450897 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/command.rb:64:in `get_filtered_instances'
13
+ E, [2014-10-14T14:05:34.450919 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/command.rb:85:in `parse_subcommand'
14
+ E, [2014-10-14T14:05:34.450940 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/command/action.rb:37:in `block in call'
15
+ E, [2014-10-14T14:05:34.450962 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
16
+ E, [2014-10-14T14:05:34.450984 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/command/action.rb:36:in `call'
17
+ E, [2014-10-14T14:05:34.451006 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/cli.rb:47:in `perform'
18
+ E, [2014-10-14T14:05:34.451028 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/cli.rb:118:in `block (2 levels) in <class:CLI>'
19
+ E, [2014-10-14T14:05:34.451050 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
20
+ E, [2014-10-14T14:05:34.451072 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
21
+ E, [2014-10-14T14:05:34.451094 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/cli.rb:233:in `invoke_task'
22
+ E, [2014-10-14T14:05:34.451116 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
23
+ E, [2014-10-14T14:05:34.451137 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
24
+ E, [2014-10-14T14:05:34.451159 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/bin/kitchen:13:in `block in <top (required)>'
25
+ E, [2014-10-14T14:05:34.451181 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/lib/kitchen/errors.rb:81:in `with_friendly_errors'
26
+ E, [2014-10-14T14:05:34.451203 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/lib/ruby/gems/2.1.0/gems/test-kitchen-1.2.1/bin/kitchen:13:in `<top (required)>'
27
+ E, [2014-10-14T14:05:34.451240 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/bin/kitchen:23:in `load'
28
+ E, [2014-10-14T14:05:34.451266 #11620] ERROR -- Kitchen: /Users/joe/.rbenv/versions/2.1.0/bin/kitchen:23:in `<main>'
29
+ E, [2014-10-14T14:05:34.451333 #11620] ERROR -- Kitchen: ----------------------
@@ -0,0 +1,2 @@
1
+ deb <%= @base_url %> <%= @distribution %> <%= @component %>
2
+ deb-src <%= @base_url %> <%= @distribution %> <%= @component %>
@@ -0,0 +1,15 @@
1
+ [<%= @name %>]
2
+ name=<%= @description %>
3
+ baseurl=<%= @base_url %>
4
+ repo_gpgcheck=<%= @repo_gpgcheck %>
5
+ <% if @priority -%>
6
+ priority=<%=@priority %>
7
+ <% end -%>
8
+ gpgcheck=0
9
+ enabled=1
10
+ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-<%= @gpg_filename %>
11
+ sslverify=1
12
+ sslcacert=/etc/pki/tls/certs/ca-bundle.crt
13
+ <% if @metadata_expire %>
14
+ metadata_expire=<%= @metadata_expire %>
15
+ <% end %>
@@ -0,0 +1,193 @@
1
+ rsyslog Cookbook CHANGELOG
2
+ ==========================
3
+ This file is used to list changes made in each version of the rsyslog cookbook.
4
+
5
+ v.2.2.0 (2015-10-05)
6
+ ----------
7
+ - Add why-run support to the file_input LWRP
8
+ - Added support for rsyslog under systemd on Ubuntu 15.04+
9
+ - Added new attribute node['rsyslog']['custom_remote']. See readme for additional information
10
+ - Added source_url and issues_url metadata for Supermarket
11
+ - Fixed 49-relp.conf to honor logs_to_forward so it didn't just forward everything
12
+ - Updated contributing and testing docs
13
+ - Set the minimum supported Chef release to 11.0
14
+ - Added maintainers.toml and maintainers.md files
15
+ - Added Amazon Linux, Oracle, and Scientific Linux to the metadata
16
+ - Removed all pre-Ruby 1.9 hash rockets
17
+ - Updated development dependencies in the
18
+ - Fix a bad example attribute in the readme
19
+ - Updated Travis CI config to test on all modern Ruby releases
20
+
21
+ v.2.1.0 (2015-07-22)
22
+ ----------
23
+ - Fixed minor markdown errors in the readme
24
+ - Allow the server to listen on both TCP and UDP. For both set node['rsyslog']['protocol'] to 'udptcp'
25
+ - Move the include for /etc/rsyslog.d/ to the very end of the rsyslog.conf config
26
+ - Added the ability to bind to a specific IP when running the server on UDP with node['rsyslog']['bind']
27
+ - Sync the comments in the rsyslog.conf file with the latest upstream rsyslog release
28
+ - Change emerg to log to :omusrmsg:* vs. * on modern rsyslog releases to avoid deprecation warnings
29
+
30
+ v.2.0.0 (2015-05-18)
31
+ --------------------
32
+ Note: This version includes several breaking changes for Ubuntu users. Be sure to take care when deploying these changes to production systems.
33
+
34
+ - 49-relp.conf now properly uses the list of servers discovered in the client recipe
35
+ - Fixed a typo that prevented file-input.conf from properly templating
36
+ - Added allow_non_local attribute to allow non-local messages. This defaults to false, which preserves the previous functionality
37
+ - The rsyslog directory permissions are now properly set using the user/group attributes instead of root/root
38
+ - Properly drop permissions on Ubuntu systems to syslog/syslog. Introduces 2 new attributes to control the user/group: priv_user and priv_group
39
+ - Remove logging to /dev/xconsole in 50-default.conf on Ubuntu systems. This is generally not something you'd want to do and produces error messages at startup.
40
+
41
+ v.1.15.0 (2015-02-23)
42
+ ---------------------
43
+ - Change minimum supported Fedora release to 20 to align with the Fedora product lifecycle
44
+ - Add supports CentOS to metadata
45
+ - Update Rubocop and Test Kitchen dependencies to the latest versions
46
+ - Update Chefspec to 4.0
47
+ - Fix CentOS 5 support in the Kitchen config
48
+ - Fix rsyslog service notification in the file_input LWRP
49
+
50
+ v.1.14.0 (2015-01-30)
51
+ ---------------------
52
+ - Don't attempt to use journald on Amazon Linux since Amazon Linux doesn't use systemd
53
+ - Fixed setting bad permissions on the working directory by using the rsyslog user/group variables.
54
+ - Fixed bad variable in the 49-relp.conf template that prevented Chef converges from completing.
55
+ - Removed the 'reload' action from the rsyslog service as newer rsyslog releases don't support reload.
56
+ - Updated Chefspecs to remove deprecation warnings and added additional tests.
57
+ - Removed node name from the comment block in the config files.
58
+ - Added a new file_input LWRP for defining configs.
59
+ - Added support for chef solo search cookbook.
60
+
61
+ v1.13.0 (2014-11-25)
62
+ --------------------
63
+ - Rsyslog's working directory is now an attribute and is set to the appropriate directory on RHEL based distros
64
+ - The working directory is now 0700 vs 0755 for additional security
65
+ - Add the ActionQueueMaxDiskSpace directive with a default of 1GB to prevent out of disk events during large buffering
66
+ - Updated RHEL / Fedora facilities to match those shipped by the distros
67
+ - Updated modules to match those used by journald (systemd) on Fedora 19+ and CentOS 7
68
+ - Added an attribute additional_directives to pass a hash of configs. This is currently only being used to pass directives necessary for journald support on RHEL 7 / Fedora 19+
69
+ - Added basic SUSE support
70
+ - Fixed logic that prevented Ubuntu from properly dropping privileges in Ubuntu >= 11.04
71
+ - Removed references to rsyslog v3 in the config template
72
+ - Added a chefignore file
73
+ - Updated Gemfile with newer releases of Test Kitchen, Rubocop, and Berkshelf
74
+ - Added Fedora 20, Debian 6/7, CentOS 7, and Ubuntu 12.04/14.04 to the Test Kitchen config
75
+ - Removed an attribute that was in the Readme twice
76
+ - Updated Travis to Ruby 2.1.1 to better match Chef 12
77
+ - Updated the Berksfile to point to Supermarket
78
+ - Refactored the specs to be more dry
79
+
80
+ v1.12.2 (2014-02-28)
81
+ --------------------
82
+ Fixing bug fix in rsyslog.conf
83
+
84
+
85
+ v1.12.0 (2014-02-27)
86
+ --------------------
87
+ - [COOK-4021] Allow specifying default templates for local and remote
88
+ - [COOK-4126] rsyslog cookbook fails restarts due to not using upstart
89
+
90
+
91
+ v1.11.0 (2014-02-19)
92
+ --------------------
93
+ ### Bug
94
+ - **[COOK-4256](https://tickets.opscode.com/browse/COOK-4256)** - Fix syntax errors in default.conf on rhel
95
+
96
+ ### New Feature
97
+ - **[COOK-4022](https://tickets.opscode.com/browse/COOK-4022)** - Add use_local_ipv4 option to allow selecting internal interface on cloud systems
98
+ - **[COOK-4018](https://tickets.opscode.com/browse/COOK-4018)** - rsyslog TLS encryption support
99
+
100
+
101
+ v1.10.2
102
+ -------
103
+ No change. Version bump for toolchain.
104
+
105
+
106
+ v1.10.0
107
+ -------
108
+ ### New Feature
109
+ - **[COOK-4021](https://tickets.opscode.com/browse/COOK-4021)** - Allow specifying default templates for local and remote
110
+
111
+ ### Improvement
112
+ - **[COOK-3876](https://tickets.opscode.com/browse/COOK-3876)** - Cater for setting rate limits
113
+
114
+
115
+ v1.9.0
116
+ ------
117
+ ### New Feature
118
+ - **[COOK-3736](https://tickets.opscode.com/browse/COOK-3736)** - Support OmniOS
119
+
120
+ ### Improvement
121
+ - **[COOK-3609](https://tickets.opscode.com/browse/COOK-3609)** - Add actionqueue to remote rsyslog configurations
122
+
123
+ ### Bug
124
+ - **[COOK-3608](https://tickets.opscode.com/browse/COOK-3608)** - Add 50-default template knobs
125
+ - **[COOK-3600](https://tickets.opscode.com/browse/COOK-3600)** - SmartOS support
126
+
127
+
128
+ v1.8.0
129
+ ------
130
+ ### Improvement
131
+ - **[COOK-3573](https://tickets.opscode.com/browse/COOK-3573)** - Add Test Kitchen, Specs, and Travis CI
132
+
133
+ ### New Feature
134
+ - **[COOK-3435](https://tickets.opscode.com/browse/COOK-3435)** - Add support for relp
135
+
136
+ v1.7.0
137
+ ------
138
+ ### Improvement
139
+ - **[COOK-3253](https://tickets.opscode.com/browse/COOK-3253)** - Enable repeated message reduction
140
+ - **[COOK-3190](https://tickets.opscode.com/browse/COOK-3190)** - Allow specifying which logs to send to remote server
141
+ - **[COOK-2355](https://tickets.opscode.com/browse/COOK-2355)** - Support forwarding events to more than one server
142
+
143
+ v1.6.0
144
+ ------
145
+ ### New Feature
146
+ - [COOK-2831]: enable high precision timestamps
147
+
148
+ ### Bug
149
+ - [COOK-2377]: calling node.save has adverse affects on nodes relying on a searched node's ohai attributes
150
+ - [COOK-2521]: rsyslog cookbook incorrectly sets directory ownership to rsyslog user
151
+ - [COOK-2540]: Syslogd needs to be disabled before starting rsyslogd on RHEL 5
152
+
153
+ ### Improvement
154
+ - [COOK-2356]: rsyslog service supports status. Service should use it.
155
+ - [COOK-2357]: rsyslog cookbook copies in wrong defaults file on Ubuntu !9.10/10.04
156
+
157
+ v1.5.0
158
+ ------
159
+ - [COOK-2141] - Add `$PreserveFQDN` configuration directive
160
+
161
+ v1.4.0
162
+ ------
163
+ - [COOK-1877] - RHEL 6 support and refactoring
164
+
165
+ v1.3.0
166
+ ------
167
+ - [COOK-1189] - template change does not restart rsyslog on Ubuntu
168
+
169
+ This actually went into 1.2.0 with action `:reload`, but that change has been reverted and the action is back to `:restart`.
170
+
171
+ v1.2.0
172
+ ------
173
+ - [COOK-1678] - syslog user does not exist on debian 6.0 and ubuntu versions lower than 11.04
174
+ - [COOK-1650] - enable max message size configuration via attribute
175
+
176
+ v1.1.0
177
+ ------
178
+ Changes from COOK-1167:
179
+
180
+ - More versatile server discovery - use the IP as an attribute, or use search (see README)
181
+ - Removed cron dependency.
182
+ - Removed log archival; logrotate is recommended.
183
+ - Add an attribute to select the per-host directory in the log dir
184
+ - Works with Chef Solo now.
185
+ - Set debian/ubuntu default user and group. Drop privileges to `syslog.adm`.
186
+
187
+
188
+ v1.0.0
189
+ ------
190
+ - [COOK-836] - use an attribute to specify the role to search for instead of relying on the rsyslog['server'] attribute.
191
+ - Clean up attribute usage to use strings instead of symbols.
192
+ - Update this README.
193
+ - Better handling for chef-solo.