OSDN Git Service

adds the Chef version pinning feature for the Debian family.
authorwhitestar <whitestar@users.osdn.me>
Mon, 17 Jul 2017 01:05:20 +0000 (10:05 +0900)
committerwhitestar <whitestar@users.osdn.me>
Mon, 17 Jul 2017 01:05:20 +0000 (10:05 +0900)
cookbooks/chef_utils/.rubocop.yml
cookbooks/chef_utils/Rakefile
cookbooks/chef_utils/metadata.rb
cookbooks/chef_utils/recipes/chef-client.rb
cookbooks/chef_utils/templates/default/etc/apt/preferences.d/chef.pref [new file with mode: 0644]
cookbooks/chef_utils/version [new file with mode: 0644]

index 0314b29..394170e 100644 (file)
@@ -23,6 +23,8 @@ Style/BlockDelimiters:
   Enabled: false
 Style/ExtraSpacing:
   Enabled: false
+Style/EmptyCaseCondition:
+  Enabled: false
 Style/FileName:
   Enabled: false
 Style/LeadingCommentSpace:
@@ -31,8 +33,12 @@ Style/RescueModifier:
   Enabled: false
 Style/SpaceBeforeFirstArg:
   Enabled: false
+Style/SpaceInsideBlockBraces:
+  Enabled: false
+Style/SpaceInsidePercentLiteralDelimiters:
+  Enabled: false
 Style/TrailingCommaInLiteral:
-  EnforcedStyleForMultiline: comma
+  EnforcedStyleForMultiline: consistent_comma
 Style/WordArray:
   Enabled: false
   
index d60d1e4..88b7bcb 100644 (file)
@@ -5,7 +5,11 @@ require 'stove/rake_task'
 
 namespace :style do
   desc 'Run Ruby style checks'
-  RuboCop::RakeTask.new(:ruby)
+  RuboCop::RakeTask.new(:ruby) do |t|
+    t.options = [
+      '--auto-gen-config',  # creates .rubocop_todo.yml
+    ]
+  end
 
   desc 'Run Chef style checks'
   FoodCritic::Rake::LintTask.new(:chef) do |t|
index 593b47b..a7a8fbf 100644 (file)
@@ -5,9 +5,16 @@ maintainer_email ''
 license          'Apache 2.0'
 description      'Installs/Configures chef_utils'
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version          '0.8.1'
+version          IO.read(File.join(File.dirname(__FILE__), 'version')).chomp
 source_url       'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
 issues_url       'https://osdn.jp/projects/metasearch/ticket'
 
+chef_version          '>= 12'
+%w( centos redhat ).each do |os|
+  supports os, '>= 7.0'
+end
+supports 'debian', '>= 8.0'
+supports 'ubuntu', '>= 14.04'
+
 depends 'build-essential'
 depends 'ssl_cert'
index 42f8aad..081a429 100644 (file)
@@ -31,6 +31,18 @@ omnitruck_installer_url = node['chef_utils']['chef-client']['omnitruck_installer
 expected_version = "[ \"$(chef-client -v | awk '{ print $2 }')\" = '#{version}' ]"
 status_file = '/tmp/install_chef-client_status'
 
+# Pinning chef version
+template '/etc/apt/preferences.d/chef.pref' do
+  source  'etc/apt/preferences.d/chef.pref'
+  owner 'root'
+  group 'root'
+  mode '0644'
+  variables(
+    pkg_name: 'chef'
+  )
+  only_if { node['platform_family'] == 'debian' }
+end
+
 remote_file pkg_file_path do
   source release_url
   checksum file_checksum unless file_checksum.nil?
diff --git a/cookbooks/chef_utils/templates/default/etc/apt/preferences.d/chef.pref b/cookbooks/chef_utils/templates/default/etc/apt/preferences.d/chef.pref
new file mode 100644 (file)
index 0000000..1526ac2
--- /dev/null
@@ -0,0 +1,3 @@
+Package: <%= @pkg_name %>
+Pin: version <%= node['chef_utils']['chef-client']['version'] %>*
+Pin-Priority: 1001
diff --git a/cookbooks/chef_utils/version b/cookbooks/chef_utils/version
new file mode 100644 (file)
index 0000000..100435b
--- /dev/null
@@ -0,0 +1 @@
+0.8.2