vagrant-junos 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 16a8b9343dcfd9927b32a4c24af87437c4ba52a3
4
- data.tar.gz: e6daa5c8ee7634d102249d042e9c5a6e3213aee3
3
+ metadata.gz: 3690c9bfb9fea7a58f1e55f8b5deba1bab84abde
4
+ data.tar.gz: acbb2731f09c4403bfc20d281c9b9376e57acda7
5
5
  SHA512:
6
- metadata.gz: 88809822a9710f05a892d1707cde9032263ee8ceee108b194596484502033cc5d82d75710571ce818784e17424a0dc9b99563d156626795c56088039c5f2548a
7
- data.tar.gz: 91eb44a22182c370a35f4f2c3ec81fe32a44749215e5b9d6314071d007fa5068d0fd9f49d67b98a74646e758767b9364a65bceffc933e365e9c0eb7de5cc9e76
6
+ metadata.gz: 7b19eae76c4d1645d414140142e89a0be0fda06d1989bc39777b8ee5d40574eddf58dd805c7495c3e4ff74197eb1fa03662afc505d4033ed3f2674f7faaa2fda
7
+ data.tar.gz: 153c318ab24d73e2096bfdff7cb6c8dd8a22238aed233e082e34cc22cb92be1cf3f18afa67a2f47086d2c202cf8f7d7e65b1295ca3b02dee630780284d0e8d25
data/.gitignore CHANGED
@@ -13,4 +13,7 @@
13
13
  *.a
14
14
  mkmf.log
15
15
  *.gem
16
- .swp
16
+ .swp
17
+
18
+ # stupid Macs
19
+ .DS_Store
@@ -11,19 +11,18 @@ module VagrantPlugins
11
11
  include Vagrant::Util
12
12
 
13
13
  def self.insert_public_key(machine, contents)
14
- contents = Vagrant::Util::Shellquote.escape(contents, "'")
14
+ contents = ShellQuote.escape(contents, "'")
15
15
  contents = contents.gsub("\n", "\\n")
16
16
 
17
17
  # render public key junos conf template, based on Vagrantfile, and upload
18
18
  public_key_module = TemplateRenderer.render('guest/junos/public_key',
19
- contents,
19
+ contents: contents,
20
20
  template_root: "#{Dir.home}/.vagrant.d/gems/gems/vagrant-junos-#{VagrantPlugins::GuestJunos::VERSION}/templates")
21
- upload(machine, public_key_module, '/mfs/tmp/set_public_Key')
21
+ upload(machine, public_key_module, '/mfs/tmp/set_public_key')
22
22
 
23
23
  # set up us root's public key
24
24
  machine.communicate.tap do |comm|
25
25
  comm.execute('cli -f /mfs/tmp/set_public_key')
26
- comm.execute('rm /mfs/tmp/set_public_key')
27
26
  end
28
27
  end
29
28
 
@@ -6,19 +6,36 @@ require 'vagrant/util/template_renderer'
6
6
  module VagrantPlugins
7
7
  module GuestJunos
8
8
  module Cap
9
- # Completely dumb check for now - only one key per user
9
+ # remove vagrant insecure public key (or anything called)
10
10
  class RemovePublicKey
11
11
  include Vagrant::Util
12
12
 
13
13
  def self.remove_public_key(machine, contents)
14
14
  contents = contents.chomp
15
- contents = Vagrant::Util::ShellQuote.escape(contents, "'")
15
+ contents = ShellQuote.escape(contents, "'")
16
16
 
17
+ # remove vagrant insecure public key (or anything called)
18
+ public_key_module = TemplateRenderer.render('guest/junos/remove_public_key',
19
+ contents: contents,
20
+ template_root: "#{Dir.home}/.vagrant.d/gems/gems/vagrant-junos-#{VagrantPlugins::GuestJunos::VERSION}/templates")
21
+ upload(machine, public_key_module, '/mfs/tmp/delete_public_key')
22
+
23
+ # delete a public key for root
17
24
  machine.communicate.tap do |comm|
18
- comm.test("test -f ~/.ssh/authorized_keys")
19
- comm.execute("cat #{contents}")
25
+ comm.execute('cli -f /mfs/tmp/delete_public_key')
20
26
  end
21
27
  end
28
+
29
+ # Upload a file.
30
+ def self.upload(machine, content, remote_temp)
31
+ local_temp = Tempfile.new('vagrant-upload')
32
+ local_temp.binmode
33
+ local_temp.write(content)
34
+ local_temp.close
35
+ machine.communicate.upload(local_temp.path, "#{remote_temp}")
36
+ local_temp.delete
37
+ end
38
+
22
39
  end
23
40
  end
24
41
  end
@@ -1,6 +1,6 @@
1
1
  module VagrantPlugins
2
2
  # Junos guest gem + plugin version
3
3
  module GuestJunos
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
6
6
  end
@@ -1,3 +1,3 @@
1
1
  configure
2
- set system root-password ssh-rsa <%= contents %>
2
+ set system root-authentication ssh-rsa "<%= contents %>"
3
3
  commit and-quit
@@ -0,0 +1,3 @@
1
+ configure
2
+ delete system root-authentication ssh-rsa "<%= contents %>"
3
+ commit and-quit
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-junos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Deatherage
@@ -107,6 +107,7 @@ files:
107
107
  - templates/guest/junos/hostname.erb
108
108
  - templates/guest/junos/network.erb
109
109
  - templates/guest/junos/public_key.erb
110
+ - templates/guest/junos/remove_public_key.erb
110
111
  - vagrant-junos.gemspec
111
112
  homepage: https://github.com/JNPRAutomate/vagrant-junos
112
113
  licenses: