OSDN Git Service

bug fix: LXD profile and network management. lxcs-0.1.5
authorwhitestar <whitestar@gaea.test>
Mon, 6 Feb 2017 13:49:24 +0000 (22:49 +0900)
committerwhitestar <whitestar@gaea.test>
Mon, 6 Feb 2017 13:49:24 +0000 (22:49 +0900)
cookbooks/lxcs/CHANGELOG.md
cookbooks/lxcs/README.md
cookbooks/lxcs/attributes/default.rb
cookbooks/lxcs/metadata.rb
cookbooks/lxcs/recipes/lxd.rb

index 9714770..84ed0f2 100644 (file)
@@ -1,5 +1,10 @@
 # lxcs CHANGELOG
 
+0.1.5
+-----
+- bug fix: LXD profile and network management.
+- revises documents.
+
 0.1.4
 -----
 - adds the `['lxcs']['lxd']['config']` attribute.
index 744283a..dcf0687 100644 (file)
@@ -174,6 +174,8 @@ override_attributes(
       },
       'config' => {
         'core.https_address' => '192.168.1.50:8443',
+        'core.trust_password' => true,
+        #'storage.zfs_pool_name' => 'lxd',
       },
       # Ubuntu >= 16.10
       'network' => {
@@ -220,6 +222,7 @@ override_attributes(
 users:
   - name: alice
     groups: sudo,wheel
+    shell: /bin/bash
     ssh-authorized-keys:
       - ssh-rsa AAAAB3Nz ...
 EOS
index d6f8bab..d468f80 100644 (file)
@@ -122,6 +122,8 @@ default['lxcs']['lxd']['config'] = {
 =begin
   # Examples
   'core.https_address' => '192.168.1.50:8443',
+  'core.trust_password' => true,
+  'storage.zfs_pool_name' => 'lxd',
 =end
 }
 # Ubuntu >= 16.10 (yakkety)
index 2ec405e..620cb30 100644 (file)
@@ -5,7 +5,7 @@ maintainer_email ''
 license          'Apache 2.0'
 description      'Installs/Configures LinuxContainers.org products'
 long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version          '0.1.4'
+version          '0.1.5'
 source_url       'http://scm.osdn.jp/gitroot/metasearch/grid-chef-repo.git'
 issues_url       'https://osdn.jp/projects/metasearch/ticket'
 
index bbd75e9..2626c67 100644 (file)
@@ -19,6 +19,8 @@
 
 lxd_conf = node['lxcs']['lxd']
 
+# Note: LXD itself does not require this directory.
+# It is used to contain configuration files that are generated by Chef.
 directory '/etc/lxd' do
   owner 'root'
   group 'root'
@@ -153,7 +155,7 @@ if platfrom_version >= '16.10'
     execute "lxc_network_create_#{net_name}" do
       command "lxc network create #{net_name} #{opts.join(' ')}"
       action :run
-      not_if "lxc network list | grep #{net_name}"
+      not_if "lxc network list | grep -E '\\s#{net_name}\\s'"
     end
 
     net_yaml_file = "/etc/lxd/network_#{net_name}_by_chef.yml"
@@ -164,7 +166,7 @@ if platfrom_version >= '16.10'
     execute net_edit_exec_name do
       command "cat #{net_yaml_file} | lxc network edit #{net_name} --force-local"
       action :nothing
-      only_if "lxc network list | grep #{net_name}"
+      only_if "lxc network list | grep -E '\\s#{net_name}\\s'"
     end
 
     execute rename_legacy_net_yaml_exec_name do
@@ -210,7 +212,7 @@ lxd_conf['profile'].each {|prof_name, hash|
   execute "lxc_profile_create_#{prof_name}" do
     command "lxc profile create #{prof_name} --force-local"
     action :run
-    not_if "lxc profile list | grep #{prof_name}"
+    not_if "lxc profile list | grep -E '(^|\\s)#{prof_name}(\\s|$)'"
   end
 
   prof_yaml_file = "/etc/lxd/profile_#{prof_name}_by_chef.yml"
@@ -219,7 +221,7 @@ lxd_conf['profile'].each {|prof_name, hash|
   execute prof_edit_exec_name do
     command "cat #{prof_yaml_file} | lxc profile edit #{prof_name} --force-local"
     action :nothing
-    only_if "lxc profile list | grep #{prof_name}"
+    only_if "lxc profile list | grep -E '(^|\\s)#{prof_name}(\\s|$)'"
   end
 
   file prof_yaml_file do