libvirtinator 0.1.1 → 0.1.2

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.
@@ -2,4 +2,5 @@
2
2
 
3
3
  chroot $1 apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
4
4
  chroot $1 sh -c "echo deb https://apt.dockerproject.org/repo ubuntu-trusty main > /etc/apt/sources.list.d/docker.list"
5
- chroot $1 apt-get update -qq && apt-get install -y docker-engine
5
+ chroot $1 apt-get update -qq
6
+ chroot $1 apt-get install -y docker-engine
@@ -1,21 +1,21 @@
1
1
  namespace :users do
2
2
 
3
3
  task :load_settings => 'libvirtinator:load_settings' do
4
- if ENV['key_path'].nil?
5
- set :path, ""
6
- until File.exists?(fetch(:path)) and (! File.directory?(fetch(:path)))
7
- ask :path, "Which private key has SSH access to the VM? Specifiy an absolute path"
4
+ if fetch(:private_key_path).nil?
5
+ SSHKit::Backend::Netssh.configure do |ssh|
6
+ ssh.ssh_options = {
7
+ forward_agent: false,
8
+ auth_methods: %w(publickey)
9
+ }
8
10
  end
9
11
  else
10
- warn "Using #{ENV['key_path']} (passed as an environment variable.)"
11
- set :path, ENV['key_path']
12
- end
13
- SSHKit::Backend::Netssh.configure do |ssh|
14
- ssh.ssh_options = {
15
- keys: fetch(:path),
16
- forward_agent: false,
17
- auth_methods: %w(publickey)
18
- }
12
+ SSHKit::Backend::Netssh.configure do |ssh|
13
+ ssh.ssh_options = {
14
+ keys: fetch(:private_key_path),
15
+ forward_agent: false,
16
+ auth_methods: %w(publickey)
17
+ }
18
+ end
19
19
  end
20
20
  end
21
21
 
@@ -65,6 +65,11 @@ namespace :users do
65
65
  end
66
66
  end
67
67
  end
68
+ run_locally do
69
+ unless fetch(:private_key_path).nil?
70
+ execute "rm", "-f", "#{fetch(:private_key_path)}*"
71
+ end
72
+ end
68
73
  info "Finished setting up users"
69
74
  end
70
75
  end
@@ -241,11 +241,13 @@ task :update_root_image => 'libvirtinator:load_settings' do
241
241
  execute "chroot", mount_point, "/bin/bash", "-c",
242
242
  "\"chown", "#{user}:#{user}", "/home/#{user}", "/home/#{user}/.ssh\""
243
243
  execute "chmod", "700", "#{mount_point}/home/#{user}/.ssh"
244
- set :path, ""
245
- until File.exists? fetch(:path) and ! File.directory? fetch(:path)
246
- ask :path, "Which public key should we install in #{user}'s authorized_keys file? Specifiy an absolute path"
244
+ key_name = "temp_key_#{fetch(:stage)}"
245
+ set :private_key_path, key_name
246
+ run_locally do
247
+ execute "rm", "-f", key_name
248
+ execute "ssh-keygen", "-P", "''", "-f", key_name
247
249
  end
248
- upload! File.open(fetch(:path)), "/tmp/pubkeys"
250
+ upload! File.open("#{key_name}.pub"), "/tmp/pubkeys"
249
251
  execute "mv", "/tmp/pubkeys", "#{mount_point}/home/#{user}/.ssh/authorized_keys"
250
252
  execute "chroot", mount_point, "/bin/bash", "-c",
251
253
  "\"chown", "#{user}:#{user}", "/home/#{user}/.ssh/authorized_keys\""
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libvirtinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-01-21 00:00:00.000000000 Z
12
+ date: 2016-02-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: capistrano