madscience 0.0.4 → 0.0.5
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/Cheffile +1 -1
- data/Cheffile.lock +12 -12
- data/cookbooks/apt/CHANGELOG.md +25 -0
- data/cookbooks/apt/README.md +4 -7
- data/cookbooks/apt/attributes/default.rb +17 -0
- data/cookbooks/apt/metadata.json +2 -2
- data/cookbooks/apt/metadata.rb +1 -1
- data/cookbooks/apt/providers/repository.rb +62 -9
- data/cookbooks/apt/recipes/default.rb +15 -8
- data/cookbooks/apt/recipes/unattended-upgrades.rb +43 -0
- data/cookbooks/apt/templates/default/20auto-upgrades.erb +2 -0
- data/cookbooks/apt/templates/default/50unattended-upgrades.erb +62 -0
- data/cookbooks/apt/templates/default/unattended-upgrades.seed.erb +1 -0
- data/cookbooks/dmg/CHANGELOG.md +3 -0
- data/cookbooks/dmg/libraries/matchers.rb +24 -0
- data/cookbooks/dmg/metadata.json +1 -1
- data/cookbooks/dmg/metadata.rb +1 -1
- data/cookbooks/vagrant/README.md +4 -2
- data/cookbooks/vagrant/attributes/default.rb +5 -4
- data/cookbooks/vagrant/libraries/helpers.rb +50 -0
- data/cookbooks/vagrant/metadata.rb +1 -1
- data/cookbooks/vagrant/recipes/mac_os_x.rb +16 -0
- data/cookbooks/windows/Berksfile +7 -0
- data/cookbooks/windows/CHANGELOG.md +31 -0
- data/cookbooks/windows/CONTRIBUTING +46 -0
- data/cookbooks/windows/Gemfile +14 -0
- data/cookbooks/windows/LICENSE +201 -0
- data/cookbooks/windows/README.md +51 -6
- data/cookbooks/windows/TODO.md +6 -0
- data/cookbooks/windows/attributes/default.rb +1 -0
- data/cookbooks/windows/chefignore +2 -0
- data/cookbooks/windows/libraries/matchers.rb +18 -3
- data/cookbooks/windows/libraries/registry_helper.rb +10 -3
- data/cookbooks/windows/libraries/version.rb +4 -3
- data/cookbooks/windows/libraries/windows_architecture_helper.rb +1 -0
- data/cookbooks/windows/libraries/windows_helper.rb +15 -1
- data/cookbooks/windows/libraries/windows_package.rb +266 -0
- data/cookbooks/windows/libraries/wmi_helper.rb +32 -0
- data/cookbooks/windows/metadata.json +12 -4
- data/cookbooks/windows/metadata.rb +1 -1
- data/cookbooks/windows/providers/auto_run.rb +2 -1
- data/cookbooks/windows/providers/batch.rb +1 -0
- data/cookbooks/windows/providers/feature_servermanagercmd.rb +17 -3
- data/cookbooks/windows/providers/font.rb +69 -0
- data/cookbooks/windows/providers/pagefile.rb +2 -2
- data/cookbooks/windows/providers/path.rb +21 -4
- data/cookbooks/windows/providers/printer.rb +1 -0
- data/cookbooks/windows/providers/printer_port.rb +1 -0
- data/cookbooks/windows/providers/reboot.rb +2 -0
- data/cookbooks/windows/providers/registry.rb +9 -6
- data/cookbooks/windows/providers/task.rb +44 -5
- data/cookbooks/windows/providers/zipfile.rb +3 -2
- data/cookbooks/windows/recipes/reboot_handler.rb +1 -1
- data/cookbooks/windows/resources/auto_run.rb +1 -1
- data/cookbooks/windows/resources/font.rb +25 -0
- data/cookbooks/windows/resources/path.rb +1 -1
- data/cookbooks/windows/resources/task.rb +3 -3
- data/cookbooks/windows/resources/zipfile.rb +1 -1
- data/cookbooks/yum/CHANGELOG.md +42 -0
- data/cookbooks/yum/README.md +11 -1
- data/cookbooks/yum/attributes/main.rb +0 -1
- data/cookbooks/yum/metadata.json +2 -2
- data/cookbooks/yum/metadata.rb +1 -2
- data/cookbooks/yum/providers/repository.rb +18 -3
- data/cookbooks/yum/recipes/default.rb +6 -14
- data/cookbooks/yum/resources/globalconfig.rb +5 -2
- data/cookbooks/yum/resources/repository.rb +7 -3
- data/cookbooks/yum/templates/default/main.erb +19 -4
- data/cookbooks/yum/templates/default/repo.erb +17 -4
- data/lib/madscience/version.rb +1 -1
- data/site-cookbooks/madscience-vagrant-cookbook/recipes/default.rb +11 -10
- metadata +17 -3
- data/cookbooks/windows/providers/package.rb +0 -252
- data/cookbooks/windows/resources/package.rb +0 -46
@@ -1,3 +1,19 @@
|
|
1
|
+
execute "uninstall Vagrant" do
|
2
|
+
# This is the recommended way to uninstall Vagrant on Mac OS X:
|
3
|
+
# https://docs.vagrantup.com/v2/installation/uninstallation.html
|
4
|
+
command <<-CMD
|
5
|
+
rm -rf /Applications/Vagrant /usr/bin/vagrant &&
|
6
|
+
pkgutil --forget com.vagrant.vagrant
|
7
|
+
CMD
|
8
|
+
not_if {
|
9
|
+
# Do not uninstall if Vagrant isn't installed.
|
10
|
+
# Do not uninstall if there is no specified version,
|
11
|
+
# or if the version requested matches the one installed.
|
12
|
+
ver = node['vagrant']['version']
|
13
|
+
!File.exists?('/usr/bin/vagrant') || !ver || `vagrant --version`[ver]
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
1
17
|
dmg_package "Vagrant" do
|
2
18
|
source node['vagrant']['url']
|
3
19
|
checksum node['vagrant']['checksum']
|
@@ -2,6 +2,37 @@ windows Cookbook CHANGELOG
|
|
2
2
|
=======================
|
3
3
|
This file is used to list changes made in each version of the windows cookbook.
|
4
4
|
|
5
|
+
v1.36.1 (2014-12-17)
|
6
|
+
--------------------
|
7
|
+
- [PR 160](https://github.com/opscode-cookbooks/windows/pull/160) - Fix Chef 11.10 / versions without windows_package in core
|
8
|
+
|
9
|
+
v1.36.0 (2014-12-16)
|
10
|
+
--------------------
|
11
|
+
- [PR 145](https://github.com/opscode-cookbooks/windows/pull/145) - do not fail on non-existant task
|
12
|
+
- [PR 144](https://github.com/opscode-cookbooks/windows/pull/144) - Add a zip example to the README
|
13
|
+
- [PR 110](https://github.com/opscode-cookbooks/windows/pull/110) - More zip documentation
|
14
|
+
- [PR 148](https://github.com/opscode-cookbooks/windows/pull/148) - Add an LWRP for font installation
|
15
|
+
- [PR 151](https://github.com/opscode-cookbooks/windows/pull/151) - Fix windows_package on Chef 12, add integration tests
|
16
|
+
- [PR 129](https://github.com/opscode-cookbooks/windows/pull/129) - Add enable/disable actions to task LWRP
|
17
|
+
- [PR 115](https://github.com/opscode-cookbooks/windows/pull/115) - require Chef::Mixin::PowershellOut before using it
|
18
|
+
- [PR 88](https://github.com/opscode-cookbooks/windows/pull/88) - Code 1003 from servermanagercmd.exe is valid
|
19
|
+
|
20
|
+
v1.34.8 (2014-10-31)
|
21
|
+
--------------------
|
22
|
+
- [Issue 137](https://github.com/opscode-cookbooks/windows/issues/137) - windows_path resource breaks with ruby 2.x
|
23
|
+
|
24
|
+
v1.34.6 (2014-09-22)
|
25
|
+
--------------------
|
26
|
+
- [Chef-2009](https://github.com/opscode/chef/issues/2009) - Patch to work around a regression in [Chef](https://github.com/opscode/chef)
|
27
|
+
|
28
|
+
v1.34.2 (2014-08-12)
|
29
|
+
--------------------
|
30
|
+
- [Issue 99](https://github.com/opscode-cookbooks/windows/issues/99) - Remove rubygems / Internet wmi-lite dependency (PR #108)
|
31
|
+
|
32
|
+
v1.34.0 (2014-08-04)
|
33
|
+
--------------------
|
34
|
+
- [Issue 99](https://github.com/opscode-cookbooks/windows/issues/99) - Use wmi-lite to fix Chef 11.14.2 break in rdp-ruby-wmi dependency
|
35
|
+
|
5
36
|
v1.32.1 (2014-07-15)
|
6
37
|
--------------------
|
7
38
|
- Fixes broken cookbook release
|
@@ -0,0 +1,46 @@
|
|
1
|
+
## Quick-contribute
|
2
|
+
|
3
|
+
* Create an issue on the github [issue tracker](https://github.com/viverae-cookbooks/apache2/issues)
|
4
|
+
* Link to your patch as a rebased git branch or pull request from the ticket
|
5
|
+
|
6
|
+
## Contributor License Agreement
|
7
|
+
|
8
|
+
For all code contributions, we ask that contributors sign a
|
9
|
+
contributor license agreement (CLA). Instructions may be found here:
|
10
|
+
|
11
|
+
* https://supermarket.chef.io/become-a-contributor
|
12
|
+
|
13
|
+
## Changelog and Readme files
|
14
|
+
|
15
|
+
When contributing changes to individual cookbooks, please do not
|
16
|
+
modify the version number in the metadata.rb. Also please do not
|
17
|
+
update the CHANGELOG.md for a new version. Not all changes to a
|
18
|
+
cookbook may be merged and released in the same versions. Chef will
|
19
|
+
handle the version updates during the release process. You are welcome
|
20
|
+
to correct typos or otherwise make updates to documentation in the
|
21
|
+
README.
|
22
|
+
|
23
|
+
## Workflow guidelines
|
24
|
+
|
25
|
+
If a contribution adds new platforms or platform versions, indicate
|
26
|
+
such in the body of the commit message(s), and mention it in the relevant
|
27
|
+
pull request or github issue. When writing commit messages, it is helpful for others if
|
28
|
+
you [indicate the Github issue number](https://help.github.com/articles/closing-issues-via-commit-messages/)
|
29
|
+
in the message.
|
30
|
+
|
31
|
+
git commit -m 'Updated pool resource to correctly delete. Fixes #nn'
|
32
|
+
|
33
|
+
On the issue itself, it is also helpful if you include log output of
|
34
|
+
a successful Chef run, but this is not absolutely required.
|
35
|
+
|
36
|
+
### Tests
|
37
|
+
|
38
|
+
This cookbook is set up to run tests under [Test Kitchen](http://kitchen.ci/).
|
39
|
+
You should be able to run the ``bundle install`` and then ``bundle exec kitchen test``
|
40
|
+
to run the integration tests. This will download an evaluation image of Windows and
|
41
|
+
run a couple of included recipes from the 'test' folder. You must have [VirtualBox](https://www.virtualbox.org/)
|
42
|
+
and [Vagrant](https://www.vagrantup.com/) installed on your system. In the future we
|
43
|
+
want to add [ServerSpec](http://serverspec.org/) tests as well.
|
44
|
+
|
45
|
+
Your contributions should not break tests and should include additional test
|
46
|
+
coverage when possible.
|
@@ -0,0 +1,14 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
# The current official branch is the 'windows-guest-support' branch, but it isn't working for me right now.
|
5
|
+
# gem "test-kitchen", :git => 'https://github.com/test-kitchen/test-kitchen.git', :branch => 'windows-guest-support'
|
6
|
+
gem 'test-kitchen', git: 'https://github.com/jdmundrawala/test-kitchen.git', :branch => 'Transport'
|
7
|
+
|
8
|
+
# afiune/Transport supports copying files from Windows -> Windows
|
9
|
+
# gem 'kitchen-vagrant', git: 'https://github.com/jdmundrawala/kitchen-vagrant.git', :branch => 'Transport'
|
10
|
+
gem 'kitchen-vagrant', git: 'https://github.com/afiune/kitchen-vagrant.git', :branch => 'Transport'
|
11
|
+
|
12
|
+
gem "berkshelf"
|
13
|
+
gem "vagrant-wrapper", ">= 2.0"
|
14
|
+
end
|
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/cookbooks/windows/README.md
CHANGED
@@ -25,6 +25,7 @@ The following cookbooks provided by Opscode are required as noted:
|
|
25
25
|
Attributes
|
26
26
|
----------
|
27
27
|
* `node['windows']['allow_pending_reboots']` - used to configure the `WindowsRebootHandler` (via the `windows::reboot_handler` recipe) to act on pending reboots. default is true (ie act on pending reboots). The value of this attribute only has an effect if the `windows::reboot_handler` is in a node's run list.
|
28
|
+
* `node['windows']['allow_reboot_on_failure']` - used to register the `WindowsRebootHandler` (via the `windows::reboot_handler` recipe) as an exception handler too to act on reboots not only at the end of successful Chef runs, but even at the end of failed runs. default is false (ie reboot only after successful runs). The value of this attribute only has an effect if the `windows::reboot_handler` is in a node's run list.
|
28
29
|
|
29
30
|
|
30
31
|
Resource/Provider
|
@@ -115,6 +116,7 @@ servermanagercmd -query
|
|
115
116
|
#### Providers
|
116
117
|
- **Chef::Provider::WindowsFeature::DISM**: Uses Deployment Image Servicing and Management (DISM) to manage roles/features.
|
117
118
|
- **Chef::Provider::WindowsFeature::ServerManagerCmd**: Uses Server Manager to manage roles/features.
|
119
|
+
- **Chef::Provider::WindowsFeaturePowershell**: Uses Powershell to manage roles/features. (see [COOK-3714](https://tickets.opscode.com/browse/COOK-3714)
|
118
120
|
|
119
121
|
#### Examples
|
120
122
|
Enable the node as a DHCP Server
|
@@ -154,6 +156,23 @@ Disable Telnet client/server
|
|
154
156
|
end
|
155
157
|
```
|
156
158
|
|
159
|
+
### windows_font
|
160
|
+
Installs a font.
|
161
|
+
|
162
|
+
Font files should be included in the cookbooks
|
163
|
+
|
164
|
+
#### Actions
|
165
|
+
- :install: install a font to the system fonts directory.
|
166
|
+
|
167
|
+
#### Attribute Parameters
|
168
|
+
- file: The name of the font file name to install. It should exist in the files/default directory of the cookbook you're calling windows_font from. Defaults to the resource name.
|
169
|
+
|
170
|
+
#### Examples
|
171
|
+
|
172
|
+
```ruby
|
173
|
+
windows_font 'Code New Roman.otf'
|
174
|
+
```
|
175
|
+
|
157
176
|
### windows_package
|
158
177
|
Manage Windows application packages in an unattended, idempotent way.
|
159
178
|
|
@@ -481,6 +500,8 @@ Server 2008 due to API usage.
|
|
481
500
|
- :delete: deletes a task
|
482
501
|
- :run: runs a task
|
483
502
|
- :change: changes the un/pw or command of a task
|
503
|
+
- :enable: enable a task
|
504
|
+
- :disable: disable a task
|
484
505
|
|
485
506
|
#### Attribute Parameters
|
486
507
|
- name: name attribute, The task name.
|
@@ -527,17 +548,32 @@ windows_task 'old task' do
|
|
527
548
|
end
|
528
549
|
```
|
529
550
|
|
551
|
+
Enable a task named 'Chef client'
|
552
|
+
```ruby
|
553
|
+
windows_task 'Chef client' do
|
554
|
+
action :enable
|
555
|
+
end
|
556
|
+
```
|
557
|
+
|
558
|
+
Disable a task named 'Chef client'
|
559
|
+
```ruby
|
560
|
+
windows_task 'Chef client' do
|
561
|
+
action :disable
|
562
|
+
end
|
563
|
+
```
|
564
|
+
|
530
565
|
### windows_zipfile
|
531
|
-
Most version of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken
|
566
|
+
Most version of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken every Chef run.
|
532
567
|
|
533
568
|
#### Actions
|
534
569
|
- :unzip: unzip a compressed file
|
570
|
+
- :zip: zip a directory (recursively)
|
535
571
|
|
536
572
|
#### Attribute Parameters
|
537
|
-
- path: name attribute. The path where files will be
|
538
|
-
- source:
|
539
|
-
- overwrite: force an overwrite of the files if
|
540
|
-
- checksum: useful if source is remote,
|
573
|
+
- path: name attribute. The path where files will be (un)zipped to.
|
574
|
+
- source: source of the zip file (either a URI or local path) for :unzip, or directory to be zipped for :zip.
|
575
|
+
- overwrite: force an overwrite of the files if they already exist.
|
576
|
+
- checksum: for :unzip, useful if source is remote, if the local file matches the SHA-256 checksum, Chef will not download it.
|
541
577
|
|
542
578
|
#### Examples
|
543
579
|
|
@@ -558,11 +594,18 @@ windows_zipfile 'c:/the_codez' do
|
|
558
594
|
end
|
559
595
|
```
|
560
596
|
|
597
|
+
Create a local zipfile
|
598
|
+
```ruby
|
599
|
+
windows_zipfile 'c:/foo/baz/the_codez.zip' do
|
600
|
+
source 'c:/the_codez'
|
601
|
+
action :zip
|
602
|
+
end
|
603
|
+
```
|
561
604
|
|
562
605
|
Exception/Report Handlers
|
563
606
|
-------------------------
|
564
607
|
### WindowsRebootHandler
|
565
|
-
Required reboots are a necessary evil of configuring and managing Windows nodes. This report handler (ie fires at the end of
|
608
|
+
Required reboots are a necessary evil of configuring and managing Windows nodes. This report handler (ie fires at the end of Chef runs) acts on requested (Chef initiated) or pending (as determined by the OS per configuration action we performed) reboots. The `allow_pending_reboots` initialization argument should be set to false if you do not want the handler to automatically reboot a node if it has been determined a reboot is pending. Reboots can still be requested explicitly via the `windows_reboot` LWRP.
|
566
609
|
|
567
610
|
### Initialization Arguments
|
568
611
|
- `allow_pending_reboots`: indicator on whether the handler should act on a the Window's 'pending reboot' state. default is true
|
@@ -637,6 +680,8 @@ override_attributes(
|
|
637
680
|
|
638
681
|
This will still allow a reboot to be explicitly requested via the `windows_reboot` LWRP.
|
639
682
|
|
683
|
+
By default, the handler will only be registered as a report handler, meaning that it will only fire at the end of successful Chef runs. If the run fails, pending or requested reboots will be ignored. This can lead to a situation where some package was installed and notified a reboot request via the `windows_reboot` LWRP, and then the run fails for some unrelated reason, and the reboot request gets dropped because the resource that notified the reboot request will already be up-to-date at the next run and will not request a reboot again, and thus the requested reboot will never be performed. To change this behavior and register the handler as an exception handler that fires at the end of failed runs too, override `node['windows']['allow_reboot_on_failure']` and set the value to true.
|
684
|
+
|
640
685
|
|
641
686
|
License & Authors
|
642
687
|
-----------------
|
@@ -0,0 +1,6 @@
|
|
1
|
+
TODO
|
2
|
+
----
|
3
|
+
* package preseeding/`response_file` support
|
4
|
+
* package installation location via a `target_dir` attribute.
|
5
|
+
* [COOK-666] `windows_package` should support CoApp packages
|
6
|
+
* WindowsRebootHandler/`windows_reboot` LWRP should support kicking off subsequent chef run on reboot.
|
@@ -1,5 +1,23 @@
|
|
1
1
|
if defined?(ChefSpec)
|
2
|
+
chefspec_version = Gem.loaded_specs["chefspec"].version
|
3
|
+
if chefspec_version < Gem::Version.new('4.1.0')
|
4
|
+
define_method = ChefSpec::Runner.method(:define_runner_method)
|
5
|
+
else
|
6
|
+
define_method = ChefSpec.method(:define_matcher)
|
7
|
+
end
|
2
8
|
|
9
|
+
define_method.call :windows_package
|
10
|
+
define_method.call :windows_feature
|
11
|
+
define_method.call :windows_task
|
12
|
+
define_method.call :windows_path
|
13
|
+
define_method.call :windows_batch
|
14
|
+
define_method.call :windows_pagefile
|
15
|
+
define_method.call :windows_zipfile
|
16
|
+
define_method.call :windows_shortcut
|
17
|
+
define_method.call :windows_auto_run
|
18
|
+
define_method.call :windows_printer
|
19
|
+
define_method.call :windows_printer_port
|
20
|
+
define_method.call :windows_reboot
|
3
21
|
#
|
4
22
|
# Assert that a +windows_package+ resource exists in the Chef run with the
|
5
23
|
# action +:install+. Given a Chef Recipe that installs "Node.js" as a
|
@@ -444,7 +462,4 @@ if defined?(ChefSpec)
|
|
444
462
|
ChefSpec::Matchers::ResourceMatcher.new(:windows_reboot, :cancel, resource_name)
|
445
463
|
end
|
446
464
|
|
447
|
-
def create_windows_shortcut(resource_name)
|
448
|
-
ChefSpec::Matchers::ResourceMatcher.new(:windows_shortcut, :create, resource_name)
|
449
|
-
end
|
450
465
|
end
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
26
26
|
require 'win32/registry'
|
27
|
-
|
27
|
+
require_relative 'wmi_helper'
|
28
28
|
end
|
29
29
|
|
30
30
|
module Windows
|
@@ -105,7 +105,7 @@ module Windows
|
|
105
105
|
end
|
106
106
|
if cur_val != val
|
107
107
|
Chef::Log.debug("setting #{key}=#{val}")
|
108
|
-
|
108
|
+
|
109
109
|
if type.nil?
|
110
110
|
type = :string
|
111
111
|
end
|
@@ -252,7 +252,14 @@ module Windows
|
|
252
252
|
|
253
253
|
def resolve_user_to_sid(username)
|
254
254
|
begin
|
255
|
-
|
255
|
+
user_query = execute_wmi_query("select * from Win32_UserAccount where Name='#{username}'")
|
256
|
+
sid = nil
|
257
|
+
|
258
|
+
user_query.each do |user|
|
259
|
+
sid = wmi_object_property(user, 'sid')
|
260
|
+
break
|
261
|
+
end
|
262
|
+
|
256
263
|
Chef::Log.debug("Resolved user SID to #{sid}")
|
257
264
|
return sid
|
258
265
|
rescue
|
@@ -19,7 +19,7 @@
|
|
19
19
|
#
|
20
20
|
|
21
21
|
if RUBY_PLATFORM =~ /mswin|mingw32|windows/
|
22
|
-
|
22
|
+
require_relative 'wmi_helper'
|
23
23
|
require 'Win32API'
|
24
24
|
end
|
25
25
|
|
@@ -100,6 +100,7 @@ module Windows
|
|
100
100
|
0x00000030 => {:ms_const => 'PRODUCT_PROFESSIONAL', :name => 'Professional'},
|
101
101
|
0x00000045 => {:ms_const => 'PRODUCT_PROFESSIONAL_E', :name => 'Not supported'},
|
102
102
|
0x00000031 => {:ms_const => 'PRODUCT_PROFESSIONAL_N', :name => 'Professional N'},
|
103
|
+
0x00000067 => {:ms_const => 'PRODUCT_PROFESSIONAL_WMC', :name => 'Professional with Media Center'},
|
103
104
|
0x00000018 => {:ms_const => 'PRODUCT_SERVER_FOR_SMALLBUSINESS', :name => 'Windows Server 2008 for Windows Essential Server Solutions'},
|
104
105
|
0x00000023 => {:ms_const => 'PRODUCT_SERVER_FOR_SMALLBUSINESS_V', :name => 'Windows Server 2008 without Hyper-V for Windows Essential Server Solutions'},
|
105
106
|
0x00000021 => {:ms_const => 'PRODUCT_SERVER_FOUNDATION', :name => 'Server Foundation'},
|
@@ -193,10 +194,10 @@ module Windows
|
|
193
194
|
# query WMI Win32_OperatingSystem for required OS info
|
194
195
|
def get_os_info
|
195
196
|
cols = %w{ Version ProductType OSProductSuite OperatingSystemSKU ServicePackMajorVersion ServicePackMinorVersion }
|
196
|
-
os_info =
|
197
|
+
os_info = execute_wmi_query("select * from Win32_OperatingSystem").each.next
|
197
198
|
cols.map do |c|
|
198
199
|
begin
|
199
|
-
os_info
|
200
|
+
wmi_object_property(os_info, c)
|
200
201
|
rescue # OperatingSystemSKU doesn't exist in all versions of Windows
|
201
202
|
nil
|
202
203
|
end
|
@@ -18,17 +18,20 @@
|
|
18
18
|
# limitations under the License.
|
19
19
|
|
20
20
|
require 'uri'
|
21
|
+
require 'Win32API' if Chef::Platform.windows?
|
22
|
+
require 'chef/exceptions'
|
21
23
|
|
22
24
|
module Windows
|
23
25
|
module Helper
|
24
26
|
|
25
27
|
AUTO_RUN_KEY = 'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run'.freeze unless defined?(AUTO_RUN_KEY)
|
26
28
|
ENV_KEY = 'HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment'.freeze unless defined?(ENV_KEY)
|
29
|
+
ExpandEnvironmentStrings = Win32API.new('kernel32', 'ExpandEnvironmentStrings', ['P', 'P', 'L'], 'L') if Chef::Platform.windows?
|
27
30
|
|
28
31
|
# returns windows friendly version of the provided path,
|
29
32
|
# ensures backslashes are used everywhere
|
30
33
|
def win_friendly_path(path)
|
31
|
-
path.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR) if path
|
34
|
+
path.gsub(::File::SEPARATOR, ::File::ALT_SEPARATOR || '\\') if path
|
32
35
|
end
|
33
36
|
|
34
37
|
# account for Window's wacky File System Redirector
|
@@ -82,6 +85,17 @@ module Windows
|
|
82
85
|
end
|
83
86
|
end
|
84
87
|
|
88
|
+
# Expands the environment variables
|
89
|
+
def expand_env_vars(path)
|
90
|
+
# We pick 32k because that is the largest it could be:
|
91
|
+
# http://msdn.microsoft.com/en-us/library/windows/desktop/ms724265%28v=vs.85%29.aspx
|
92
|
+
buf = 0.chr * 32 * 1024 # 32k
|
93
|
+
if ExpandEnvironmentStrings.call(path.dup, buf, buf.length) == 0
|
94
|
+
raise Chef::Exceptions::Win32APIError, "Failed calling ExpandEnvironmentStrings (received 0)"
|
95
|
+
end
|
96
|
+
buf.strip
|
97
|
+
end
|
98
|
+
|
85
99
|
end
|
86
100
|
end
|
87
101
|
|