vagrant-gitcredentials 0.0.21 → 0.0.22
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.
|
@@ -7,20 +7,26 @@ module VagrantPlugins
|
|
|
7
7
|
script = ["GITHUB_USERNAME=$1", "GITHUB_PASSWORD=$2"]
|
|
8
8
|
script.concat(["ssh-keygen -N '' -f ~/.ssh/github_rsa", "ssh-add ~/.ssh/github_rsa"])
|
|
9
9
|
script.concat(["set -- $(<~/.ssh/github_rsa.pub)", 'JSON=\'{"title":"vagrant provision key", "key": "ssh-rsa \'$2\'"}\''])
|
|
10
|
-
script.concat(['curl -u "$GITHUB_USERNAME:$GITHUB_PASSWORD" -d "$JSON" https://api.github.com/user/keys'])
|
|
11
|
-
|
|
12
|
-
#
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
10
|
+
script.concat(['curl -u "$GITHUB_USERNAME:$GITHUB_PASSWORD" -d "$JSON" https://api.github.com/user/keys > ~/.ssh/git.response'])
|
|
11
|
+
|
|
12
|
+
# if we have a successful response, skip generating key
|
|
13
|
+
unless @machine.communicate.test('grep '"id"' ~/.ssh/git.response')
|
|
14
|
+
|
|
15
|
+
@machine.communicate.execute("echo '' > ~/.ssh/github.sh")
|
|
16
|
+
# create script
|
|
17
|
+
script.each {
|
|
18
|
+
|l|
|
|
19
|
+
e = Shellwords.escape(l);
|
|
20
|
+
@machine.communicate.execute("echo #{e} >> ~/.ssh/github.sh")
|
|
21
|
+
}
|
|
22
|
+
# set permissions for execution
|
|
23
|
+
@machine.communicate.execute("chmod 755 ~/.ssh/github.sh")
|
|
24
|
+
@machine.communicate.execute("cat ~/.ssh/github.sh")
|
|
25
|
+
# execute script w/ permissions
|
|
26
|
+
promptCredentials()
|
|
27
|
+
@machine.communicate.execute("sh ~/.ssh/github.sh #@gitUsername #@gitPassword")
|
|
28
|
+
end
|
|
29
|
+
|
|
24
30
|
@machine.communicate.execute("sh /vagrant_shared/build/scripts/recipies/github.sh")
|
|
25
31
|
|
|
26
32
|
@ui.info("created ssh key")
|