natives 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +8 -8
  2. data/Gemfile +2 -3
  3. data/Gemfile.lock +12 -53
  4. data/README.md +126 -29
  5. data/Rakefile +4 -5
  6. data/VERSION +1 -1
  7. data/bin/natives +1 -0
  8. data/catalogs/rubygems.yaml +50 -0
  9. data/lib/natives/apps/detect.rb +21 -0
  10. data/lib/natives/apps/list.rb +39 -0
  11. data/lib/natives/apps.rb +2 -0
  12. data/lib/natives/catalog/loader.rb +30 -0
  13. data/lib/natives/catalog/merger.rb +26 -0
  14. data/lib/natives/catalog/selector.rb +79 -0
  15. data/lib/natives/catalog/validator.rb +18 -0
  16. data/lib/natives/catalog.rb +56 -0
  17. data/lib/natives/cli.rb +27 -42
  18. data/lib/natives/gemfile_viewer.rb +19 -16
  19. data/lib/natives/host_detection/package_provider.rb +83 -0
  20. data/lib/natives/host_detection/platform.rb +34 -0
  21. data/lib/natives/host_detection.rb +25 -0
  22. data/lib/natives.rb +1 -0
  23. data/spec/fixtures/dir_with_matching_files/invalid1.yml +9 -0
  24. data/spec/fixtures/dir_with_matching_files/not_matching.json +0 -0
  25. data/spec/fixtures/dir_with_matching_files/valid1.yaml +21 -0
  26. data/spec/fixtures/dir_with_matching_files/valid2.yml +9 -0
  27. data/spec/fixtures/dir_without_matching_file/not_matching.json +0 -0
  28. data/spec/natives/apps/detect_spec.rb +26 -0
  29. data/spec/natives/apps/list_spec.rb +58 -0
  30. data/spec/natives/catalog/loader_spec.rb +101 -0
  31. data/spec/natives/catalog/merger_spec.rb +60 -0
  32. data/spec/natives/catalog/selector_spec.rb +124 -0
  33. data/spec/natives/catalog/validator_spec.rb +44 -0
  34. data/spec/natives/catalog_spec.rb +133 -0
  35. data/spec/natives/gemfile_viewer_spec.rb +3 -3
  36. data/spec/natives/host_detection/package_provider_spec.rb +33 -0
  37. data/spec/natives/host_detection/platform_spec.rb +21 -0
  38. data/spec/natives/host_detection_spec.rb +45 -0
  39. data/spec/spec_helper.rb +17 -2
  40. metadata +44 -66
  41. data/chef/.kitchen.yml +0 -27
  42. data/chef/Berksfile +0 -4
  43. data/chef/Berksfile.lock +0 -10
  44. data/chef/cookbooks/natives/Berksfile +0 -3
  45. data/chef/cookbooks/natives/Gemfile +0 -5
  46. data/chef/cookbooks/natives/LICENSE +0 -3
  47. data/chef/cookbooks/natives/README.md +0 -13
  48. data/chef/cookbooks/natives/chefignore +0 -96
  49. data/chef/cookbooks/natives/libraries/natives_recipe_helper.rb +0 -37
  50. data/chef/cookbooks/natives/metadata.rb +0 -9
  51. data/chef/cookbooks/natives/recipes/default.rb +0 -31
  52. data/chef/solo.rb +0 -17
  53. data/chef/vendored-cookbooks/apt/CHANGELOG.md +0 -144
  54. data/chef/vendored-cookbooks/apt/README.md +0 -247
  55. data/chef/vendored-cookbooks/apt/attributes/default.rb +0 -27
  56. data/chef/vendored-cookbooks/apt/files/default/apt-proxy-v2.conf +0 -50
  57. data/chef/vendored-cookbooks/apt/libraries/helpers.rb +0 -47
  58. data/chef/vendored-cookbooks/apt/libraries/network.rb +0 -33
  59. data/chef/vendored-cookbooks/apt/metadata.json +0 -54
  60. data/chef/vendored-cookbooks/apt/metadata.rb +0 -34
  61. data/chef/vendored-cookbooks/apt/providers/preference.rb +0 -61
  62. data/chef/vendored-cookbooks/apt/providers/repository.rb +0 -141
  63. data/chef/vendored-cookbooks/apt/recipes/cacher-client.rb +0 -81
  64. data/chef/vendored-cookbooks/apt/recipes/cacher-ng.rb +0 -43
  65. data/chef/vendored-cookbooks/apt/recipes/default.rb +0 -83
  66. data/chef/vendored-cookbooks/apt/resources/preference.rb +0 -30
  67. data/chef/vendored-cookbooks/apt/resources/repository.rb +0 -41
  68. data/chef/vendored-cookbooks/apt/templates/debian-6.0/acng.conf.erb +0 -173
  69. data/chef/vendored-cookbooks/apt/templates/default/01proxy.erb +0 -5
  70. data/chef/vendored-cookbooks/apt/templates/default/acng.conf.erb +0 -275
  71. data/chef/vendored-cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +0 -269
  72. data/chef/vendored-cookbooks/homebrew/CHANGELOG.md +0 -36
  73. data/chef/vendored-cookbooks/homebrew/README.md +0 -110
  74. data/chef/vendored-cookbooks/homebrew/attributes/default.rb +0 -22
  75. data/chef/vendored-cookbooks/homebrew/libraries/homebrew_mixin.rb +0 -53
  76. data/chef/vendored-cookbooks/homebrew/libraries/homebrew_package.rb +0 -104
  77. data/chef/vendored-cookbooks/homebrew/metadata.json +0 -32
  78. data/chef/vendored-cookbooks/homebrew/metadata.rb +0 -10
  79. data/chef/vendored-cookbooks/homebrew/providers/tap.rb +0 -48
  80. data/chef/vendored-cookbooks/homebrew/recipes/default.rb +0 -46
  81. data/chef/vendored-cookbooks/homebrew/resources/tap.rb +0 -35
  82. data/lib/natives/app.rb +0 -71
  83. data/natives.gemspec +0 -125
  84. data/spec/natives/app_spec.rb +0 -153
data/chef/.kitchen.yml DELETED
@@ -1,27 +0,0 @@
1
- ---
2
- driver_plugin: vagrant
3
- driver_config:
4
- require_chef_omnibus: true
5
-
6
- platforms:
7
- - name: ubuntu-12.04
8
- driver_config:
9
- box: opscode-ubuntu-12.04
10
- box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-12.04_provisionerless.box
11
- - name: ubuntu-10.04
12
- driver_config:
13
- box: opscode-ubuntu-10.04
14
- box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_ubuntu-10.04_provisionerless.box
15
- - name: centos-6.4
16
- driver_config:
17
- box: opscode-centos-6.4
18
- box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_provisionerless.box
19
- - name: centos-5.9
20
- driver_config:
21
- box: opscode-centos-5.9
22
- box_url: https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.9_provisionerless.box
23
-
24
- suites:
25
- - name: default
26
- run_list: []
27
- attributes: {}
data/chef/Berksfile DELETED
@@ -1,4 +0,0 @@
1
- site :opscode
2
-
3
- cookbook 'homebrew', '>= 1.5.0'
4
- cookbook 'apt', '>= 2.3.0'
data/chef/Berksfile.lock DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "sources": {
3
- "homebrew": {
4
- "locked_version": "1.5.0"
5
- },
6
- "apt": {
7
- "locked_version": "2.3.0"
8
- }
9
- }
10
- }
@@ -1,3 +0,0 @@
1
- site :opscode
2
-
3
- metadata
@@ -1,5 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- gem 'berkshelf'
4
- gem 'test-kitchen', :group => :integration
5
- gem 'kitchen-vagrant', :group => :integration
@@ -1,3 +0,0 @@
1
- Copyright (C) 2013 YOUR_NAME
2
-
3
- All rights reserved - Do Not Redistribute
@@ -1,13 +0,0 @@
1
- # natives cookbook
2
-
3
- # Requirements
4
-
5
- # Usage
6
-
7
- # Attributes
8
-
9
- # Recipes
10
-
11
- # Author
12
-
13
- Author:: YOUR_NAME (<YOUR_EMAIL>)
@@ -1,96 +0,0 @@
1
- # Put files/directories that should be ignored in this file when uploading
2
- # or sharing to the community site.
3
- # Lines that start with '# ' are comments.
4
-
5
- # OS generated files #
6
- ######################
7
- .DS_Store
8
- Icon?
9
- nohup.out
10
- ehthumbs.db
11
- Thumbs.db
12
-
13
- # SASS #
14
- ########
15
- .sass-cache
16
-
17
- # EDITORS #
18
- ###########
19
- \#*
20
- .#*
21
- *~
22
- *.sw[a-z]
23
- *.bak
24
- REVISION
25
- TAGS*
26
- tmtags
27
- *_flymake.*
28
- *_flymake
29
- *.tmproj
30
- .project
31
- .settings
32
- mkmf.log
33
-
34
- ## COMPILED ##
35
- ##############
36
- a.out
37
- *.o
38
- *.pyc
39
- *.so
40
- *.com
41
- *.class
42
- *.dll
43
- *.exe
44
- */rdoc/
45
-
46
- # Testing #
47
- ###########
48
- .watchr
49
- .rspec
50
- spec/*
51
- spec/fixtures/*
52
- test/*
53
- features/*
54
- Guardfile
55
- Procfile
56
-
57
- # SCM #
58
- #######
59
- .git
60
- */.git
61
- .gitignore
62
- .gitmodules
63
- .gitconfig
64
- .gitattributes
65
- .svn
66
- */.bzr/*
67
- */.hg/*
68
- */.svn/*
69
-
70
- # Berkshelf #
71
- #############
72
- Berksfile
73
- Berksfile.lock
74
- cookbooks/*
75
- tmp
76
-
77
- # Cookbooks #
78
- #############
79
- CONTRIBUTING
80
- CHANGELOG*
81
-
82
- # Strainer #
83
- ############
84
- Colanderfile
85
- Strainerfile
86
- .colander
87
- .strainer
88
-
89
- # Vagrant #
90
- ###########
91
- .vagrant
92
- Vagrantfile
93
-
94
- # Travis #
95
- ##########
96
- .travis.yml
@@ -1,37 +0,0 @@
1
- module NativesRecipeHelper
2
- def use_homebrew?
3
- ::File.exist? '/usr/local/bin/brew'
4
- end
5
-
6
- def use_apt?
7
- !which('apt-get').nil?
8
- end
9
-
10
- def natives_install_list
11
- node["natives"]["install_list"]
12
- end
13
-
14
- def current_package_provider
15
- package_provider = Chef::Platform.find_provider_for_node({
16
- platform: node[:platform], platform_version: node[:platform_version]},
17
- ::Chef::Resource::Package.new(""))
18
- package_provider.to_s.split('::').last.downcase
19
- end
20
-
21
- def which(cmd)
22
- paths = (ENV['PATH'].split(::File::PATH_SEPARATOR) + %w(/bin /usr/bin /sbin /usr/sbin))
23
-
24
- paths.each do |path|
25
- possible = File.join(path, cmd)
26
- return possible if File.executable?(possible)
27
- end
28
-
29
- nil
30
- end
31
- end
32
-
33
- class Chef
34
- class Recipe
35
- include NativesRecipeHelper
36
- end
37
- end
@@ -1,9 +0,0 @@
1
- name 'natives'
2
- maintainer 'YOUR_NAME'
3
- maintainer_email 'YOUR_EMAIL'
4
- license 'All rights reserved'
5
- description 'Installs/Configures natives'
6
- long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
7
- version '0.1.0'
8
-
9
- depends 'homebrew'
@@ -1,31 +0,0 @@
1
- #
2
- # Cookbook Name:: natives
3
- # Recipe:: default
4
- #
5
- # Copyright (C) 2013 YOUR_NAME
6
- #
7
- # All rights reserved - Do Not Redistribute
8
- #
9
-
10
- require 'natives/catalog'
11
-
12
- if node['natives']['configs']['update_provider']
13
- include_recipe('homebrew') if use_homebrew?
14
- include_recipe('apt') if use_apt?
15
- end
16
-
17
- natives_install_list.each do |catalog_name, entries|
18
- catalog = Natives::Catalog.new(
19
- catalog_name,
20
- node[:platform], node[:platform_version],
21
- current_package_provider,
22
- working_dir: node['natives']['configs']['working_dir']
23
- )
24
- packages = catalog.native_packages_for(entries)
25
-
26
- packages.each do |package_name|
27
- package package_name do
28
- action :install
29
- end
30
- end
31
- end
data/chef/solo.rb DELETED
@@ -1,17 +0,0 @@
1
- log_level :error
2
-
3
- base_path = File.absolute_path(File.join(File.dirname(__FILE__)))
4
-
5
- cookbook_path [
6
- File.join(base_path, 'cookbooks'),
7
- File.join(base_path, 'vendored-cookbooks')
8
- ]
9
-
10
- nodes_path File.join(base_path, 'nodes')
11
- role_path File.join(base_path, 'roles')
12
- data_bag_path File.join(base_path, 'data_bags')
13
- encrypted_data_bag_secret File.join(base_path, 'data_bag_key')
14
-
15
- chef_tmp_path = File.absolute_path(File.join('.', '.natives/chef'))
16
- file_cache_path File.join(chef_tmp_path, 'cache')
17
- file_backup_path File.join(chef_tmp_path, 'backup')
@@ -1,144 +0,0 @@
1
- apt Cookbook CHANGELOG
2
- ======================
3
- This file is used to list changes made in each version of the apt cookbook.
4
-
5
-
6
- v2.3.0
7
- ------
8
- ### Bug
9
- - **[COOK-3812](https://tickets.opscode.com/browse/COOK-3812)** - Add a way to bypass the apt existence check
10
-
11
- ### Improvement
12
- - **[COOK-3567](https://tickets.opscode.com/browse/COOK-3567)** - Allow users to bypass apt-cache via attributes
13
-
14
-
15
- v2.2.1
16
- ------
17
- ### Improvement
18
- - **[COOK-664](https://tickets.opscode.com/browse/COOK-664)** - Check platform before running apt-specific commands
19
-
20
-
21
- v2.2.0
22
- ------
23
- ### Bug
24
- - **[COOK-3707](https://tickets.opscode.com/browse/COOK-3707)** - multiple nics confuse apt::cacher-client
25
-
26
- v2.1.2
27
- ------
28
- ### Improvement
29
- - **[COOK-3551](https://tickets.opscode.com/browse/COOK-3551)** - Allow user to set up a trusted APT repository
30
-
31
- v2.1.1
32
- ------
33
- ### Bug
34
- - **[COOK-1856](https://tickets.opscode.com/browse/COOK-1856)** - Match GPG keys without case sensitivity
35
-
36
- v2.1.0
37
- ------
38
- - [COOK-3426]: cacher-ng fails with restrict_environment set to true
39
- - [COOK-2859]: cacher-client executes out of order
40
- - [COOK-3052]: Long GPG keys are downloaded on every run
41
- - [COOK-1856]: apt cookbook should match keys without case sensitivity
42
- - [COOK-3255]: Attribute name incorrect in README
43
- - [COOK-3225]: Call use_inline_resources only if defined
44
- - [COOK-3386]: Cache dir for apt-cacher-ng
45
- - [COOK-3291]: apt_repository: enable usage of a keyserver on port 80
46
- - Greatly expanded test coverage with ChefSpec and Test-Kitchen
47
-
48
- v2.0.0
49
- ------
50
- ### Bug
51
-
52
- - [COOK-2258]: apt: LWRP results in error under why-run mode in apt 1.9.0 cookbook
53
-
54
- v1.10.0
55
- -------
56
- ### Improvement
57
-
58
- - [COOK-2885]: Improvements for apt cache server search
59
-
60
- ### Bug
61
-
62
- - [COOK-2441]: Apt recipe broken in new chef version
63
- - [COOK-2660]: Create Debian 6.0 "squeeze" specific template for
64
- apt-cacher-ng
65
-
66
- v1.9.2
67
- ------
68
- - [COOK-2631] - Create Ubuntu 10.04 specific template for apt-cacher-ng
69
-
70
- v1.9.0
71
- ------
72
- - [COOK-2185] - Proxy for apt-key
73
- - [COOK-2338] - Support pinning by glob() or regexp
74
-
75
- v1.8.4
76
- ------
77
- - [COOK-2171] - Update README to clarify required Chef version: 10.18.0
78
- or higher.
79
-
80
- v1.8.2
81
- ------
82
- - [COOK-2112] - need [] around "arch" in sources.list entries
83
- - [COOK-2171] - fixes a regression in the notification
84
-
85
- v1.8.0
86
- ------
87
- - [COOK-2143] - Allow for a custom cacher-ng port
88
- - [COOK-2171] - On `apt_repository.run_action(:add)` the source file
89
- is not created.
90
- - [COOK-2184] - apt::cacher-ng, use `cacher_port` attribute in
91
- acng.conf
92
-
93
- v1.7.0
94
- ------
95
- - [COOK-2082] - add "arch" parameter to apt_repository LWRP
96
-
97
- v1.6.0
98
- ------
99
- - [COOK-1893] - `apt_preference` use "`package_name`" resource instead of "name"
100
- - [COOK-1894] - change filename for sources.list.d files
101
- - [COOK-1914] - Wrong dir permissions for /etc/apt/preferences.d/
102
- - [COOK-1942] - README.md has wrong name for the keyserver attribute
103
- - [COOK-2019] - create 01proxy before any other apt-get updates get executed
104
-
105
- v1.5.2
106
- ------
107
- - [COOK-1682] - use template instead of file resource in apt::cacher-client
108
- - [COOK-1875] - cacher-client should be Environment-aware
109
-
110
- V1.5.0
111
- ------
112
- - [COOK-1500] - Avoid triggering apt-get update
113
- - [COOK-1548] - Add execute commands for autoclean and autoremove
114
- - [COOK-1591] - Setting up the apt proxy should leave https
115
- connections direct
116
- - [COOK-1596] - execute[apt-get-update-periodic] never runs
117
- - [COOK-1762] - create /etc/apt/preferences.d directory
118
- - [COOK-1776] - apt key check isn't idempotent
119
-
120
- v1.4.8
121
- ------
122
- * Adds test-kitchen support
123
- - [COOK-1435] - repository lwrp is not idempotent with http key
124
-
125
- v1.4.6
126
- ------
127
- - [COOK-1530] - apt_repository isn't aware of update-success-stamp
128
- file (also reverts COOK-1382 patch).
129
-
130
- v1.4.4
131
- ------
132
- - [COOK-1229] - Allow cacher IP to be set manually in non-Chef Solo
133
- environments
134
- - [COOK-1530] - Immediately update apt-cache when sources.list file is dropped off
135
-
136
- v1.4.2
137
- ------
138
- - [COOK-1155] - LWRP for apt pinning
139
-
140
- v1.4.0
141
- ------
142
- - [COOK-889] - overwrite existing repo source files
143
- - [COOK-921] - optionally use cookbook\_file or remote\_file for key
144
- - [COOK-1032] - fixes problem with apt repository key installation
@@ -1,247 +0,0 @@
1
- apt Cookbook
2
- ============
3
- This cookbook includes recipes to execute apt-get update to ensure the local APT package cache is up to date. There are recipes for managing the apt-cacher-ng caching proxy and proxy clients. It also includes a LWRP for managing APT repositories in /etc/apt/sources.list.d as well as an LWRP for pinning packages via /etc/apt/preferences.d.
4
-
5
-
6
- Requirements
7
- ------------
8
- **Version 2.0.0+ of this cookbook requires Chef 11.0.0 or later**. If your Chef version is earlier than 11.0.0, use version 1.10.0 of this cookbook.
9
-
10
- Version 1.8.2 to 1.10.0 of this cookbook requires **Chef 10.16.4** or later.
11
-
12
- If your Chef version is earlier than 10.16.4, use version 1.7.0 of this cookbook.
13
-
14
- ### Platform
15
- Please refer to the [TESTING file](TESTING.md) to see the currently (and passing) tested platforms. The release was tested on:
16
-
17
- * Ubuntu 10.04
18
- * Ubuntu 12.04
19
- * Ubuntu 13.04
20
- * Debian 7.1
21
- * Debian 6.0 (have with manual testing)
22
-
23
- May work with or without modification on other Debian derivatives.
24
-
25
-
26
- -------
27
- ### default
28
- This recipe installs the `update-notifier-common` package to provide the timestamp file used to only run `apt-get update` if the cache is more than one day old.
29
-
30
- This recipe should appear first in the run list of Debian or Ubuntu nodes to ensure that the package cache is up to date before managing any `package` resources with Chef.
31
-
32
- This recipe also sets up a local cache directory for preseeding packages.
33
-
34
- **Including the default recipe on a node that does not support apt (such as Windows) results in a noop.**
35
-
36
- ### cacher-client
37
- Configures the node to use the `apt-cacher-ng` server as a client.
38
-
39
- #### Bypassing the cache
40
- Occasionally you may come across repositories that do not play nicely when the node is using an `apt-cacher-ng` server. You can configure `cacher-client` to bypass the server and connect directly to the repository with the `cache_bypass` attribute.
41
-
42
- To do this, you need to override the `cache_bypass` attribute with an array of repositories, with each array key as the repository URL and value as the protocol to use:
43
-
44
- ```json
45
- {
46
- ...,
47
- 'apt': {
48
- ...,
49
- 'cache_bypass': {
50
- URL: PROTOCOL
51
- }
52
- }
53
- }
54
- ```
55
-
56
- For example, to prevent caching and directly connect to the repository at `download.oracle.com` via http:
57
-
58
- ```json
59
- {
60
- 'apt': {
61
- 'cache_bypass': {
62
- 'download.oracle.com': 'http'
63
- }
64
- }
65
- }
66
- ```
67
-
68
- ### cacher-ng
69
- Installs the `apt-cacher-ng` package and service so the system can provide APT caching. You can check the usage report at http://{hostname}:3142/acng-report.html.
70
-
71
- If you wish to help the `cacher-ng` recipe seed itself, you must now explicitly include the `cacher-client` recipe in your run list **after** `cacher-ng` or you will block your ability to install any packages (ie. `apt-cacher-ng`).
72
-
73
-
74
- Attributes
75
- ----------
76
- * `['apt']['cacher_ipaddress']` - use a cacher server (or standard proxy server) not available via search
77
- * `['apt']['cacher_interface]` - interface to connect to the cacher-ng service, no default.
78
- * `['apt']['cacher_port']` - port for the cacher-ng service (either client or server), default is '3142'
79
- * `['apt']['cacher_dir']` - directory used by cacher-ng service, default is '/var/cache/apt-cacher-ng'
80
- * `['apt']['cacher-client']['restrict_environment']` - restrict your node to using the `apt-cacher-ng` server in your Environment, default is 'false'
81
- * `['apt']['compiletime']` - force the `cacher-client` recipe to run before other recipes. It forces apt to use the proxy before other recipes run. Useful if your nodes have limited access to public apt repositories. This is overridden if the `cacher-ng` recipe is in your run list. Default is 'false'
82
- * `['apt']['cache_bypass']` - array of URLs to bypass the cache. Accepts the URL and protocol to fetch directly from the remote repository and not attempt to cache
83
-
84
- Libraries
85
- ---------
86
- There is an `interface_ipaddress` method that returns the IP address for a particular host and interface, used by the `cacher-client` recipe. To enable it on the server use the `['apt']['cacher_interface']` attribute.
87
-
88
- Resources/Providers
89
- -------------------
90
- ### `apt_repository`
91
- This LWRP provides an easy way to manage additional APT repositories. Adding a new repository will notify running the `execute[apt-get-update]` resource immediately.
92
-
93
- #### Actions
94
- - :add: creates a repository file and builds the repository listing
95
- - :remove: removes the repository file
96
-
97
- #### Attribute Parameters
98
- - repo_name: name attribute. The name of the channel to discover
99
- - uri: the base of the Debian distribution
100
- - distribution: this is usually your release's codename...ie something like `karmic`, `lucid` or `maverick`
101
- - components: package groupings..when it doubt use `main`
102
- - arch: constrain package to a particular arch like `i386`, `amd64` or even `armhf` or `powerpc`. Defaults to nil.
103
- - trusted: treat all packages from this repository as authenticated regardless of signature
104
- - deb_src: whether or not to add the repository as a source repo as well - value can be `true` or `false`, default `false`.
105
- - keyserver: the GPG keyserver where the key for the repo should be retrieved
106
- - key: if a `keyserver` is provided, this is assumed to be the fingerprint, otherwise it can be either the URI to the GPG key for the repo, or a cookbook_file.
107
- - key_proxy: if set, pass the specified proxy via `http-proxy=` to GPG.
108
- - cookbook: if key should be a cookbook_file, specify a cookbook where the key is located for files/default. Defaults to nil, so it will use the cookbook where the resource is used.
109
-
110
- #### Examples
111
-
112
- Add the Zenoss repo:
113
-
114
- ```ruby
115
- apt_repository 'zenoss' do
116
- uri 'http://dev.zenoss.org/deb'
117
- components ['main', 'stable']
118
- end
119
- ```
120
-
121
- Add the Nginx PPA, grabbing the key from keyserver:
122
-
123
- ```ruby
124
- apt_repository 'nginx-php' do
125
- uri 'http://ppa.launchpad.net/nginx/php5/ubuntu'
126
- distribution node['lsb']['codename']
127
- components ['main']
128
- keyserver 'keyserver.ubuntu.com'
129
- key 'C300EE8C'
130
- end
131
- ```
132
-
133
- Add the Nginx PPA, grab the key from the keyserver, and add source repo:
134
-
135
- ```ruby
136
- apt_repository 'nginx-php' do
137
- uri 'http://ppa.launchpad.net/nginx/php5/ubuntu'
138
- distribution node['lsb']['codename']
139
- components ['main']
140
- keyserver 'keyserver.ubuntu.com'
141
- key 'C300EE8C'
142
- deb_src true
143
- end
144
- ```
145
-
146
- Add the Cloudera Repo of CDH4 packages for Ubuntu 12.04 on AMD64:
147
-
148
- ```ruby
149
- apt_repository 'cloudera' do
150
- uri 'http://archive.cloudera.com/cdh4/ubuntu/precise/amd64/cdh'
151
- arch 'amd64'
152
- distribution 'precise-cdh4'
153
- components ['contrib']
154
- key 'http://archive.cloudera.com/debian/archive.key'
155
- end
156
- ```
157
-
158
- Remove Zenoss repo:
159
-
160
- ```ruby
161
- apt_repository 'zenoss' do
162
- action :remove
163
- end
164
- ```
165
-
166
- ### `apt_preference`
167
- This LWRP provides an easy way to pin packages in /etc/apt/preferences.d. Although apt-pinning is quite helpful from time to time please note that Debian does not encourage its use without thorough consideration.
168
-
169
- Further information regarding apt-pinning is available via http://wiki.debian.org/AptPreferences.
170
-
171
- #### Actions
172
- - :add: creates a preferences file under /etc/apt/preferences.d
173
- - :remove: Removes the file, therefore unpin the package
174
-
175
- #### Attribute Parameters
176
- - package_name: name attribute. The name of the package
177
- - glob: Pin by glob() expression or regexp surrounded by /.
178
- - pin: The package version/repository to pin
179
- - pin_priority: The pinning priority aka "the highest package version wins"
180
-
181
- #### Examples
182
- Pin libmysqlclient16 to version 5.1.49-3:
183
-
184
- ```ruby
185
- apt_preference 'libmysqlclient16' do
186
- pin 'version 5.1.49-3'
187
- pin_priority '700'
188
- end
189
- ```
190
-
191
- Unpin libmysqlclient16:
192
-
193
- ```ruby
194
- apt_preference 'libmysqlclient16' do
195
- action :remove
196
- end
197
- ```
198
-
199
- Pin all packages from dotdeb.org:
200
-
201
- ```ruby
202
- apt_preference 'dotdeb' do
203
- glob '*'
204
- pin 'origin packages.dotdeb.org'
205
- pin_priority '700'
206
- end
207
- ```
208
-
209
-
210
- Usage
211
- -----
212
- Put `recipe[apt]` first in the run list. If you have other recipes that you want to use to configure how apt behaves, like new sources, notify the execute resource to run, e.g.:
213
-
214
- ```ruby
215
- template '/etc/apt/sources.list.d/my_apt_sources.list' do
216
- notifies :run, 'execute[apt-get update]', :immediately
217
- end
218
- ```
219
-
220
- The above will run during execution phase since it is a normal template resource, and should appear before other package resources that need the sources in the template.
221
-
222
- Put `recipe[apt::cacher-ng]` in the run_list for a server to provide APT caching and add `recipe[apt::cacher-client]` on the rest of the Debian-based nodes to take advantage of the caching server.
223
-
224
- If you want to cleanup unused packages, there is also the `apt-get autoclean` and `apt-get autoremove` resources provided for automated cleanup.
225
-
226
-
227
- License & Authors
228
- -----------------
229
- - Author:: Joshua Timberman (joshua@opscode.com)
230
- - Author:: Matt Ray (matt@opscode.com)
231
- - Author:: Seth Chisamore (schisamo@opscode.com)
232
-
233
- ```text
234
- Copyright 2009-2013, Opscode, Inc.
235
-
236
- Licensed under the Apache License, Version 2.0 (the "License");
237
- you may not use this file except in compliance with the License.
238
- You may obtain a copy of the License at
239
-
240
- http://www.apache.org/licenses/LICENSE-2.0
241
-
242
- Unless required by applicable law or agreed to in writing, software
243
- distributed under the License is distributed on an "AS IS" BASIS,
244
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
245
- See the License for the specific language governing permissions and
246
- limitations under the License.
247
- ```
@@ -1,27 +0,0 @@
1
- #
2
- # Cookbook Name:: apt
3
- # Attributes:: default
4
- #
5
- # Copyright 2009-2013, Opscode, Inc.
6
- #
7
- # Licensed under the Apache License, Version 2.0 (the "License");
8
- # you may not use this file except in compliance with the License.
9
- # You may obtain a copy of the License at
10
- #
11
- # http://www.apache.org/licenses/LICENSE-2.0
12
- #
13
- # Unless required by applicable law or agreed to in writing, software
14
- # distributed under the License is distributed on an "AS IS" BASIS,
15
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
-
20
- default['apt']['cacher-client']['restrict_environment'] = false
21
- default['apt']['cacher_dir'] = '/var/cache/apt-cacher-ng'
22
- default['apt']['cacher_interface'] = nil
23
- default['apt']['cacher_port'] = 3142
24
- default['apt']['caching_server'] = false
25
- default['apt']['compiletime'] = false
26
- default['apt']['key_proxy'] = ''
27
- default['apt']['cache_bypass'] = {}