OSDN Git Service

fix service control. samba-grid-0.1.3
authorwhitestar <whitestar@users.osdn.me>
Sun, 16 Sep 2018 09:42:43 +0000 (18:42 +0900)
committerwhitestar <whitestar@users.osdn.me>
Sun, 16 Sep 2018 09:42:43 +0000 (18:42 +0900)
cookbooks/samba-grid/.rubocop.yml
cookbooks/samba-grid/Berksfile [new file with mode: 0644]
cookbooks/samba-grid/CHANGELOG.md
cookbooks/samba-grid/Gemfile.lock [new file with mode: 0644]
cookbooks/samba-grid/Rakefile
cookbooks/samba-grid/concourse.yml
cookbooks/samba-grid/fly-vars.local.yml [new file with mode: 0644]
cookbooks/samba-grid/fly-vars.yml
cookbooks/samba-grid/metadata.rb
cookbooks/samba-grid/recipes/server.rb
cookbooks/samba-grid/version [new file with mode: 0644]

index ea75259..ef166ac 100644 (file)
@@ -24,6 +24,8 @@ Style/RescueModifier:
   Enabled: false
 Style/SpaceBeforeFirstArg:
   Enabled: false
+Style/SpaceInsideBlockBraces:
+  Enabled: false
 Style/TrailingCommaInLiteral:
   EnforcedStyleForMultiline: consistent_comma
 Style/WordArray:
diff --git a/cookbooks/samba-grid/Berksfile b/cookbooks/samba-grid/Berksfile
new file mode 100644 (file)
index 0000000..2500fb4
--- /dev/null
@@ -0,0 +1,19 @@
+#
+# Copyright 2018 whitestar
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+source 'https://supermarket.chef.io'
+
+metadata
index 6304d16..2218dd4 100644 (file)
@@ -1,5 +1,9 @@
 # samba-grid CHANGELOG
 
+0.1.3
+-----
+- fix service control.
+
 0.1.2
 -----
 - adds the Debian 9 (stretch) support.
diff --git a/cookbooks/samba-grid/Gemfile.lock b/cookbooks/samba-grid/Gemfile.lock
new file mode 100644 (file)
index 0000000..6fb9a3b
--- /dev/null
@@ -0,0 +1,22 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    chef-api (0.8.0)
+      logify (~> 0.1)
+      mime-types
+    logify (0.2.0)
+    mime-types (3.2.2)
+      mime-types-data (~> 3.2015)
+    mime-types-data (3.2018.0812)
+    stove (6.0.0)
+      chef-api (~> 0.5)
+      logify (~> 0.2)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  stove
+
+BUNDLED WITH
+   1.16.0
index 8b85e6a..f1c82d7 100644 (file)
@@ -3,12 +3,56 @@ require 'rubocop/rake_task'
 require 'foodcritic'
 require 'stove/rake_task'
 
+tpl_cookbook = '00cookbook'
+cookbook_name = File.basename(Dir.pwd)
+
+desc 'Initialize project'
+task :init do
+  next if cookbook_name == tpl_cookbook
+
+  [
+    '.foodcritic',
+    '.rubocop.yml',
+    'Berksfile',
+    'concourse.yml',
+    'fly-vars.yml',
+    'fly-vars.local.yml',
+    'Gemfile',
+    'Gemfile.lock',
+    'version',
+  ].each {|conf|
+    sh "cp ../#{tpl_cookbook}/#{conf} ./" unless File.exist?(conf)
+  }
+
+  ruby [
+    %(-pne '$_.gsub!(/^cookbook-name: .*$/, "cookbook-name: #{cookbook_name}")'),
+    '-i fly-vars.local.yml',
+  ].join(' ')
+end
+
+desc 'Update project'
+task :update do
+  next if cookbook_name == tpl_cookbook
+
+  [
+    'Rakefile',
+    'concourse.yml',
+    'fly-vars.yml',
+    'Gemfile',
+    'Gemfile.lock',
+  ].each {|conf|
+    sh "cp ../#{tpl_cookbook}/#{conf} ./"
+  }
+end
+
+desc 'fly set-pipeline'
 task :'set-pipeline' do
   sh [
-    "fly -t $CC_TARGET sp -p #{File.basename(Dir.pwd)}-cookbook -c concourse.yml",
-    '-l fly-vars.yml -l ~/sec/credentials-prod.yml',
+    "fly -t $CC_TARGET sp -p #{cookbook_name}-cookbook -c concourse.yml",
+    '-l fly-vars.yml -l fly-vars.local.yml -l ~/sec/credentials-prod.yml',
   ].join(' ')
 end
+desc 'rake set-pipeline alias'
 task sp: 'set-pipeline'
 
 namespace :style do
index 8fbcb07..d373185 100644 (file)
@@ -1,13 +1,15 @@
 ---
-# $ fly -t $CC_TARGET sp -p samba-grid-cookbook -c concourse.yml -l fly-vars.yml -l ~/credentials.yml
 resources:
 - name: src-git
   type: git
   source:
-    uri: git://git.osdn.net/gitroot/metasearch/grid-chef-repo.git
+    uri: ((git-id-osdn))@git.osdn.net:/gitroot/metasearch/grid-chef-repo.git
     branch: master
     paths:
     - cookbooks/((cookbook-name))
+    private_key: ((git-private-key))
+    git_user: ((git-user-osdn))
+  #check_every: 1h  # default: 1m
 - name: chefdk-cache
   type: docker-image
   source:
@@ -18,18 +20,24 @@ resources:
     ca_certs:
     - domain: ((registry-mirror-domain))  # e.g. registry.docker.example.com:5000
       cert: ((docker-reg-ca-cert))
+  check_every: 6h  # default: 1m
 
 jobs:
-- name: build-cookbook
+- name: test-cookbook
   plan:
-  - get: src-git
-    trigger: true
-  - get: chefdk-cache
+  - aggregate:
+    - get: src-git
+      params:
+        depth: 5
+      trigger: true
+    - get: chefdk-cache
   - task: ci-build
     image: chefdk-cache
+    params:
+      http_proxy: ((http-proxy))  # e.g. http://proxy.example.com:3128
+      #HTTP_PROXY: ((http-proxy))
     config:
       platform: linux
-
       #image_resource:
       #  type: docker-image
       #  source:
@@ -40,10 +48,8 @@ jobs:
           #ca_certs:
           #- domain: ((registry-mirror-domain))
           #  cert: ((docker-reg-ca-cert))
-
       inputs:
       - name: src-git
-
       run:
         #dir: ./src-git/cookbooks/((cookbook-name))
         #path: rake
@@ -55,3 +61,41 @@ jobs:
           bundle config --local silence_root_warning 1
           bundle install
           rake
+- name: publish-cookbook
+  plan:
+  - aggregate:
+    - get: src-git
+      params:
+        depth: 5
+      trigger: false
+      passed: [test-cookbook]
+    - get: chefdk-cache
+      passed: [test-cookbook]
+  - task: publish
+    image: chefdk-cache
+    params:
+      http_proxy: ((http-proxy))
+      chef_username: ((chef-username))
+      chef_client_key: ((chef-client-key))
+    config:
+      platform: linux
+      inputs:
+      - name: src-git
+      run:
+        path: /bin/bash
+        args:
+        - -c
+        - |
+          echo '{"username":"((chef-username))","key":"/root/chef-client-key.pem"}' > /root/.stove
+          echo "$chef_client_key"  > /root/chef-client-key.pem
+          cd ./src-git/cookbooks/((cookbook-name))
+          bundle config --local silence_root_warning 1
+          bundle install
+          rake publish
+  - put: src-git
+    params:
+      repository: src-git
+      tag_prefix: ((cookbook-name))-
+      tag: src-git/cookbooks/((cookbook-name))/version
+      only_tag: true
+      annotate: src-git/cookbooks/((cookbook-name))/version
diff --git a/cookbooks/samba-grid/fly-vars.local.yml b/cookbooks/samba-grid/fly-vars.local.yml
new file mode 100644 (file)
index 0000000..c9c6a42
--- /dev/null
@@ -0,0 +1,2 @@
+---
+cookbook-name: samba-grid
index d3d14aa..76f2fcd 100644 (file)
@@ -1,3 +1,2 @@
 ---
-cookbook-name: samba-grid
-chefdk-version: 0.17.17
+chefdk-version: 1.6.11
index 7daeffa..af8a16f 100644 (file)
@@ -5,11 +5,12 @@ maintainer_email ''
 license          'Apache 2.0'
 description      'Installs/Configures Samba'
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version          '0.1.2'
+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'
 
-%w( debian ubuntu ).each do |os|
+chef_version     '>= 12'
+%w(debian ubuntu).each do |os|
   supports os
 end
 
index 2ca1802..7a5bba7 100644 (file)
@@ -2,7 +2,7 @@
 # Cookbook Name:: samba-grid
 # Recipe:: server
 #
-# Copyright 2016-2017, whitestar
+# Copyright 2016-2018, whitestar
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -44,13 +44,13 @@ services = [
   'smbd',
 ]
 services.push('samba-ad-dc') if platform == 'debian' && platform_version < '9.0'
-#'samba-ad-dc',  # masked on latest Ubuntu.
-#'samba',        # masked on latest Debian and Ubuntu.
+# Note: systemd services by default
+# 'samba-ad-dc',  # masked on latest Ubuntu.
+# 'samba',        # masked on latest Debian and Ubuntu.
 
 services.each {|srv|
   service srv do
     action [:enable]
-    #action [:enable, :start]
     supports status: true, restart: true, reload: false
   end
 }
@@ -62,8 +62,8 @@ template '/etc/samba/smb.conf' do
   owner 'root'
   group 'root'
   mode '0644'
-  notifies :reload, 'service[nmbd]'
-  notifies :reload, 'service[smbd]'
-  notifies :reload, 'service[samba-ad-dc]' if platform == 'debian' && platform_version < '9.0'
+  notifies :restart, 'service[nmbd]'
+  notifies :restart, 'service[smbd]'
+  notifies :restart, 'service[samba-ad-dc]' if platform == 'debian' && platform_version < '9.0'
   #notifies :reload, 'service[samba]'
 end
diff --git a/cookbooks/samba-grid/version b/cookbooks/samba-grid/version
new file mode 100644 (file)
index 0000000..b1e80bb
--- /dev/null
@@ -0,0 +1 @@
+0.1.3