vagrant-junos 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/.gitignore +4 -1
- data/lib/vagrant-junos/cap/insert_public_key.rb +3 -4
- data/lib/vagrant-junos/cap/remove_public_key.rb +21 -4
- data/lib/vagrant-junos/version.rb +1 -1
- data/templates/guest/junos/public_key.erb +1 -1
- data/templates/guest/junos/remove_public_key.erb +3 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3690c9bfb9fea7a58f1e55f8b5deba1bab84abde
|
4
|
+
data.tar.gz: acbb2731f09c4403bfc20d281c9b9376e57acda7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7b19eae76c4d1645d414140142e89a0be0fda06d1989bc39777b8ee5d40574eddf58dd805c7495c3e4ff74197eb1fa03662afc505d4033ed3f2674f7faaa2fda
|
7
|
+
data.tar.gz: 153c318ab24d73e2096bfdff7cb6c8dd8a22238aed233e082e34cc22cb92be1cf3f18afa67a2f47086d2c202cf8f7d7e65b1295ca3b02dee630780284d0e8d25
|
data/.gitignore
CHANGED
@@ -11,19 +11,18 @@ module VagrantPlugins
|
|
11
11
|
include Vagrant::Util
|
12
12
|
|
13
13
|
def self.insert_public_key(machine, contents)
|
14
|
-
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/
|
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
|
-
#
|
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 =
|
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.
|
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
|
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.
|
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:
|