vagrant-plugin-dummy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +20 -0
- data/Gemfile +11 -0
- data/README.md +24 -0
- data/Rakefile +15 -0
- data/lib/vagrant-plugin-dummy/communication/communicator.rb +51 -0
- data/lib/vagrant-plugin-dummy/errors.rb +13 -0
- data/lib/vagrant-plugin-dummy/guest/dummy.rb +48 -0
- data/lib/vagrant-plugin-dummy/monkey_patches/lib/vagrant/machine.rb +27 -0
- data/lib/vagrant-plugin-dummy/plugin.rb +100 -0
- data/lib/vagrant-plugin-dummy/version.rb +3 -0
- data/lib/vagrant-plugin-dummy.rb +24 -0
- data/locales/en.yml +8 -0
- data/oldgit/FETCH_HEAD +4 -0
- data/oldgit/HEAD +1 -0
- data/oldgit/ORIG_HEAD +1 -0
- data/oldgit/config +12 -0
- data/oldgit/description +1 -0
- data/oldgit/hooks/applypatch-msg.sample +15 -0
- data/oldgit/hooks/commit-msg.sample +24 -0
- data/oldgit/hooks/post-update.sample +8 -0
- data/oldgit/hooks/pre-applypatch.sample +14 -0
- data/oldgit/hooks/pre-commit.sample +50 -0
- data/oldgit/hooks/pre-rebase.sample +169 -0
- data/oldgit/hooks/prepare-commit-msg.sample +36 -0
- data/oldgit/hooks/update.sample +128 -0
- data/oldgit/index +0 -0
- data/oldgit/info/exclude +6 -0
- data/oldgit/logs/HEAD +13 -0
- data/oldgit/logs/refs/heads/dummy-master +1 -0
- data/oldgit/logs/refs/heads/master +2 -0
- data/oldgit/logs/refs/heads/vagrant-1.2 +3 -0
- data/oldgit/logs/refs/remotes/origin/HEAD +1 -0
- data/oldgit/logs/refs/remotes/origin/chef-schtasks +1 -0
- data/oldgit/logs/refs/remotes/origin/master +2 -0
- data/oldgit/logs/refs/remotes/origin/vagrant-1.2 +3 -0
- data/oldgit/logs/refs/remotes/origin/winrm-2.0 +1 -0
- data/oldgit/objects/pack/pack-829e113048479ca488917c38a7779511189ee623.idx +0 -0
- data/oldgit/objects/pack/pack-829e113048479ca488917c38a7779511189ee623.pack +0 -0
- data/oldgit/objects/pack/pack-9d783f03b5d312d0eb7c60c232336524cf240841.idx +0 -0
- data/oldgit/objects/pack/pack-9d783f03b5d312d0eb7c60c232336524cf240841.pack +0 -0
- data/oldgit/objects/pack/pack-fc30e147a30fce4b4b0e300c3cdb4743945456d4.idx +0 -0
- data/oldgit/objects/pack/pack-fc30e147a30fce4b4b0e300c3cdb4743945456d4.pack +0 -0
- data/oldgit/packed-refs +9 -0
- data/oldgit/refs/heads/dummy-master +1 -0
- data/oldgit/refs/heads/master +1 -0
- data/oldgit/refs/heads/vagrant-1.2 +1 -0
- data/oldgit/refs/remotes/origin/chef-schtasks +1 -0
- data/oldgit/refs/remotes/origin/master +1 -0
- data/oldgit/refs/remotes/origin/vagrant-1.2 +1 -0
- data/oldgit/refs/remotes/origin/winrm-2.0 +1 -0
- data/spec/vagrant-windows/config_spec.rb +58 -0
- data/spec/vagrant-windows/guestnetwork_spec.rb +48 -0
- data/spec/vagrant-windows/helper_spec.rb +38 -0
- data/spec/vagrant-windows/winrmcommunicator_spec.rb +27 -0
- data/vagrant-plugin-dummy.gemspec +53 -0
- data/windows/communication/guestnetwork.rb +133 -0
- data/windows/communication/winrmcommunicator.rb +120 -0
- data/windows/communication/winrmfinder.rb +45 -0
- data/windows/communication/winrmshell.rb +141 -0
- data/windows/config/windows.rb +35 -0
- data/windows/config/winrm.rb +51 -0
- data/windows/errors.rb +27 -0
- data/windows/guest/cap/change_host_name.rb +14 -0
- data/windows/guest/cap/configure_networks.rb +69 -0
- data/windows/guest/cap/halt.rb +22 -0
- data/windows/guest/cap/mount_virtualbox_shared_folder.rb +17 -0
- data/windows/guest/cap/mount_vmware_shared_folder.rb +15 -0
- data/windows/guest/windows.rb +71 -0
- data/windows/helper.rb +19 -0
- data/windows/monkey_patches/lib/vagrant/machine.rb +32 -0
- data/windows/monkey_patches/plugins/providers/virtualbox/action/share_folders.rb +44 -0
- data/windows/monkey_patches/plugins/providers/virtualbox/driver/version_4_2.rb +20 -0
- data/windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_client.rb +1 -0
- data/windows/monkey_patches/plugins/provisioners/chef/provisioner/chef_solo.rb +106 -0
- data/windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet.rb +101 -0
- data/windows/monkey_patches/plugins/provisioners/puppet/provisioner/puppet_server.rb +1 -0
- data/windows/monkey_patches/plugins/provisioners/shell/provisioner.rb +89 -0
- data/windows/plugin.rb +129 -0
- data/windows/scripts/cheftask.ps1.erb +47 -0
- data/windows/scripts/cheftask.xml.erb +45 -0
- data/windows/scripts/cheftaskrun.ps1.erb +16 -0
- data/windows/scripts/command_alias.ps1 +36 -0
- data/windows/scripts/mount_volume.virtualbox.ps1.erb +49 -0
- data/windows/scripts/mount_volume.vmware.ps1.erb +49 -0
- data/windows/scripts/set_work_network.ps1 +6 -0
- data/windows/scripts/winrs_v3_get_adapters.ps1 +11 -0
- data/windows/version.rb +3 -0
- metadata +207 -0
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to prepare the commit log message.
|
4
|
+
# Called by "git commit" with the name of the file that has the
|
5
|
+
# commit message, followed by the description of the commit
|
6
|
+
# message's source. The hook's purpose is to edit the commit
|
7
|
+
# message file. If the hook fails with a non-zero status,
|
8
|
+
# the commit is aborted.
|
9
|
+
#
|
10
|
+
# To enable this hook, rename this file to "prepare-commit-msg".
|
11
|
+
|
12
|
+
# This hook includes three examples. The first comments out the
|
13
|
+
# "Conflicts:" part of a merge commit.
|
14
|
+
#
|
15
|
+
# The second includes the output of "git diff --name-status -r"
|
16
|
+
# into the message, just before the "git status" output. It is
|
17
|
+
# commented because it doesn't cope with --amend or with squashed
|
18
|
+
# commits.
|
19
|
+
#
|
20
|
+
# The third example adds a Signed-off-by line to the message, that can
|
21
|
+
# still be edited. This is rarely a good idea.
|
22
|
+
|
23
|
+
case "$2,$3" in
|
24
|
+
merge,)
|
25
|
+
/usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
|
26
|
+
|
27
|
+
# ,|template,)
|
28
|
+
# /usr/bin/perl -i.bak -pe '
|
29
|
+
# print "\n" . `git diff --cached --name-status -r`
|
30
|
+
# if /^#/ && $first++ == 0' "$1" ;;
|
31
|
+
|
32
|
+
*) ;;
|
33
|
+
esac
|
34
|
+
|
35
|
+
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
36
|
+
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
@@ -0,0 +1,128 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# An example hook script to blocks unannotated tags from entering.
|
4
|
+
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
5
|
+
#
|
6
|
+
# To enable this hook, rename this file to "update".
|
7
|
+
#
|
8
|
+
# Config
|
9
|
+
# ------
|
10
|
+
# hooks.allowunannotated
|
11
|
+
# This boolean sets whether unannotated tags will be allowed into the
|
12
|
+
# repository. By default they won't be.
|
13
|
+
# hooks.allowdeletetag
|
14
|
+
# This boolean sets whether deleting tags will be allowed in the
|
15
|
+
# repository. By default they won't be.
|
16
|
+
# hooks.allowmodifytag
|
17
|
+
# This boolean sets whether a tag may be modified after creation. By default
|
18
|
+
# it won't be.
|
19
|
+
# hooks.allowdeletebranch
|
20
|
+
# This boolean sets whether deleting branches will be allowed in the
|
21
|
+
# repository. By default they won't be.
|
22
|
+
# hooks.denycreatebranch
|
23
|
+
# This boolean sets whether remotely creating branches will be denied
|
24
|
+
# in the repository. By default this is allowed.
|
25
|
+
#
|
26
|
+
|
27
|
+
# --- Command line
|
28
|
+
refname="$1"
|
29
|
+
oldrev="$2"
|
30
|
+
newrev="$3"
|
31
|
+
|
32
|
+
# --- Safety check
|
33
|
+
if [ -z "$GIT_DIR" ]; then
|
34
|
+
echo "Don't run this script from the command line." >&2
|
35
|
+
echo " (if you want, you could supply GIT_DIR then run" >&2
|
36
|
+
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
37
|
+
exit 1
|
38
|
+
fi
|
39
|
+
|
40
|
+
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
41
|
+
echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
|
42
|
+
exit 1
|
43
|
+
fi
|
44
|
+
|
45
|
+
# --- Config
|
46
|
+
allowunannotated=$(git config --bool hooks.allowunannotated)
|
47
|
+
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
48
|
+
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
49
|
+
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
50
|
+
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
51
|
+
|
52
|
+
# check for no description
|
53
|
+
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
54
|
+
case "$projectdesc" in
|
55
|
+
"Unnamed repository"* | "")
|
56
|
+
echo "*** Project description file hasn't been set" >&2
|
57
|
+
exit 1
|
58
|
+
;;
|
59
|
+
esac
|
60
|
+
|
61
|
+
# --- Check types
|
62
|
+
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
63
|
+
zero="0000000000000000000000000000000000000000"
|
64
|
+
if [ "$newrev" = "$zero" ]; then
|
65
|
+
newrev_type=delete
|
66
|
+
else
|
67
|
+
newrev_type=$(git cat-file -t $newrev)
|
68
|
+
fi
|
69
|
+
|
70
|
+
case "$refname","$newrev_type" in
|
71
|
+
refs/tags/*,commit)
|
72
|
+
# un-annotated tag
|
73
|
+
short_refname=${refname##refs/tags/}
|
74
|
+
if [ "$allowunannotated" != "true" ]; then
|
75
|
+
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
76
|
+
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
77
|
+
exit 1
|
78
|
+
fi
|
79
|
+
;;
|
80
|
+
refs/tags/*,delete)
|
81
|
+
# delete tag
|
82
|
+
if [ "$allowdeletetag" != "true" ]; then
|
83
|
+
echo "*** Deleting a tag is not allowed in this repository" >&2
|
84
|
+
exit 1
|
85
|
+
fi
|
86
|
+
;;
|
87
|
+
refs/tags/*,tag)
|
88
|
+
# annotated tag
|
89
|
+
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
90
|
+
then
|
91
|
+
echo "*** Tag '$refname' already exists." >&2
|
92
|
+
echo "*** Modifying a tag is not allowed in this repository." >&2
|
93
|
+
exit 1
|
94
|
+
fi
|
95
|
+
;;
|
96
|
+
refs/heads/*,commit)
|
97
|
+
# branch
|
98
|
+
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
99
|
+
echo "*** Creating a branch is not allowed in this repository" >&2
|
100
|
+
exit 1
|
101
|
+
fi
|
102
|
+
;;
|
103
|
+
refs/heads/*,delete)
|
104
|
+
# delete branch
|
105
|
+
if [ "$allowdeletebranch" != "true" ]; then
|
106
|
+
echo "*** Deleting a branch is not allowed in this repository" >&2
|
107
|
+
exit 1
|
108
|
+
fi
|
109
|
+
;;
|
110
|
+
refs/remotes/*,commit)
|
111
|
+
# tracking branch
|
112
|
+
;;
|
113
|
+
refs/remotes/*,delete)
|
114
|
+
# delete tracking branch
|
115
|
+
if [ "$allowdeletebranch" != "true" ]; then
|
116
|
+
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
117
|
+
exit 1
|
118
|
+
fi
|
119
|
+
;;
|
120
|
+
*)
|
121
|
+
# Anything else (is there anything else?)
|
122
|
+
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
123
|
+
exit 1
|
124
|
+
;;
|
125
|
+
esac
|
126
|
+
|
127
|
+
# --- Finished
|
128
|
+
exit 0
|
data/oldgit/index
ADDED
Binary file
|
data/oldgit/info/exclude
ADDED
data/oldgit/logs/HEAD
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
0000000000000000000000000000000000000000 5a67f142b4cc3a0faa74861d20e350495d33ac1a Bryan Bishop <kanzure@gmail.com> 1374786892 -0500 clone: from https://github.com/WinRb/vagrant-windows.git
|
2
|
+
5a67f142b4cc3a0faa74861d20e350495d33ac1a af2bead0eda037b8f5f4033c2942f6a597204864 Bryan Bishop <kanzure@gmail.com> 1374786940 -0500 checkout: moving from master to origin/vagrant-1.2
|
3
|
+
af2bead0eda037b8f5f4033c2942f6a597204864 af2bead0eda037b8f5f4033c2942f6a597204864 Bryan Bishop <kanzure@gmail.com> 1374786952 -0500 checkout: moving from af2bead0eda037b8f5f4033c2942f6a597204864 to vagrant-1.2
|
4
|
+
af2bead0eda037b8f5f4033c2942f6a597204864 a72f90691991ff92fbcbbf5ca5142735e42f6609 Bryan Bishop <kanzure@gmail.com> 1377480141 -0500 merge origin/vagrant-1.2: Fast-forward
|
5
|
+
a72f90691991ff92fbcbbf5ca5142735e42f6609 5a67f142b4cc3a0faa74861d20e350495d33ac1a Bryan Bishop <kanzure@gmail.com> 1378825564 -0500 checkout: moving from vagrant-1.2 to master
|
6
|
+
5a67f142b4cc3a0faa74861d20e350495d33ac1a a72f90691991ff92fbcbbf5ca5142735e42f6609 Bryan Bishop <kanzure@gmail.com> 1378825575 -0500 checkout: moving from master to vagrant-1.2
|
7
|
+
a72f90691991ff92fbcbbf5ca5142735e42f6609 b4c93197e40d3c2b38d06f316bfb1fd5f0a120de Bryan Bishop <kanzure@gmail.com> 1378825580 -0500 merge origin/vagrant-1.2: Fast-forward
|
8
|
+
b4c93197e40d3c2b38d06f316bfb1fd5f0a120de 5a67f142b4cc3a0faa74861d20e350495d33ac1a Bryan Bishop <kanzure@gmail.com> 1378825632 -0500 checkout: moving from vagrant-1.2 to master
|
9
|
+
5a67f142b4cc3a0faa74861d20e350495d33ac1a b4c93197e40d3c2b38d06f316bfb1fd5f0a120de Bryan Bishop <kanzure@gmail.com> 1378825935 -0500 checkout: moving from master to vagrant-1.2
|
10
|
+
b4c93197e40d3c2b38d06f316bfb1fd5f0a120de 5a67f142b4cc3a0faa74861d20e350495d33ac1a Bryan Bishop <kanzure@gmail.com> 1378825958 -0500 checkout: moving from vagrant-1.2 to master
|
11
|
+
5a67f142b4cc3a0faa74861d20e350495d33ac1a a98d27d5b4f16de29bd3bf9c486d25b14d5960c3 Bryan Bishop <kanzure@gmail.com> 1378825961 -0500 merge origin/master: Fast-forward
|
12
|
+
a98d27d5b4f16de29bd3bf9c486d25b14d5960c3 b4c93197e40d3c2b38d06f316bfb1fd5f0a120de Bryan Bishop <kanzure@gmail.com> 1378825967 -0500 checkout: moving from master to vagrant-1.2
|
13
|
+
b4c93197e40d3c2b38d06f316bfb1fd5f0a120de b4c93197e40d3c2b38d06f316bfb1fd5f0a120de Bryan Bishop <kanzure@gmail.com> 1378826075 -0500 checkout: moving from vagrant-1.2 to dummy-master
|
@@ -0,0 +1 @@
|
|
1
|
+
0000000000000000000000000000000000000000 b4c93197e40d3c2b38d06f316bfb1fd5f0a120de Bryan Bishop <kanzure@gmail.com> 1378826075 -0500 branch: Created from HEAD
|
@@ -0,0 +1,2 @@
|
|
1
|
+
0000000000000000000000000000000000000000 5a67f142b4cc3a0faa74861d20e350495d33ac1a Bryan Bishop <kanzure@gmail.com> 1374786892 -0500 clone: from https://github.com/WinRb/vagrant-windows.git
|
2
|
+
5a67f142b4cc3a0faa74861d20e350495d33ac1a a98d27d5b4f16de29bd3bf9c486d25b14d5960c3 Bryan Bishop <kanzure@gmail.com> 1378825961 -0500 merge origin/master: Fast-forward
|
@@ -0,0 +1,3 @@
|
|
1
|
+
0000000000000000000000000000000000000000 af2bead0eda037b8f5f4033c2942f6a597204864 Bryan Bishop <kanzure@gmail.com> 1374786952 -0500 branch: Created from refs/remotes/origin/vagrant-1.2
|
2
|
+
af2bead0eda037b8f5f4033c2942f6a597204864 a72f90691991ff92fbcbbf5ca5142735e42f6609 Bryan Bishop <kanzure@gmail.com> 1377480141 -0500 merge origin/vagrant-1.2: Fast-forward
|
3
|
+
a72f90691991ff92fbcbbf5ca5142735e42f6609 b4c93197e40d3c2b38d06f316bfb1fd5f0a120de Bryan Bishop <kanzure@gmail.com> 1378825580 -0500 merge origin/vagrant-1.2: Fast-forward
|
@@ -0,0 +1 @@
|
|
1
|
+
0000000000000000000000000000000000000000 5a67f142b4cc3a0faa74861d20e350495d33ac1a Bryan Bishop <kanzure@gmail.com> 1374786892 -0500 clone: from https://github.com/WinRb/vagrant-windows.git
|
@@ -0,0 +1 @@
|
|
1
|
+
0000000000000000000000000000000000000000 10332b013b911516b20c344f933aadafefc9b752 Bryan Bishop <kanzure@raichu.austin.rr.com> 1374786936 -0500 fetch origin: storing head
|
@@ -0,0 +1,2 @@
|
|
1
|
+
0000000000000000000000000000000000000000 5a67f142b4cc3a0faa74861d20e350495d33ac1a Bryan Bishop <kanzure@raichu.austin.rr.com> 1374786936 -0500 fetch origin: storing head
|
2
|
+
5a67f142b4cc3a0faa74861d20e350495d33ac1a a98d27d5b4f16de29bd3bf9c486d25b14d5960c3 Bryan Bishop <kanzure@gmail.com> 1377480129 -0500 fetch origin: fast-forward
|
@@ -0,0 +1,3 @@
|
|
1
|
+
0000000000000000000000000000000000000000 af2bead0eda037b8f5f4033c2942f6a597204864 Bryan Bishop <kanzure@raichu.austin.rr.com> 1374786936 -0500 fetch origin: storing head
|
2
|
+
af2bead0eda037b8f5f4033c2942f6a597204864 a72f90691991ff92fbcbbf5ca5142735e42f6609 Bryan Bishop <kanzure@gmail.com> 1377480129 -0500 fetch origin: fast-forward
|
3
|
+
a72f90691991ff92fbcbbf5ca5142735e42f6609 b4c93197e40d3c2b38d06f316bfb1fd5f0a120de Bryan Bishop <kanzure@gmail.com> 1378825571 -0500 fetch origin: fast-forward
|
@@ -0,0 +1 @@
|
|
1
|
+
0000000000000000000000000000000000000000 f09f1b803ab437ec9e31d28560df03add6944308 Bryan Bishop <kanzure@raichu.austin.rr.com> 1374786936 -0500 fetch origin: storing head
|
data/oldgit/packed-refs
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
86e18c3696e7ee39c19e895bcf16c860ab89b3cc refs/tags/v0.0.1
|
2
|
+
48d1706053b6702cf180ac6fd997f760a515e5ad refs/tags/v0.0.2
|
3
|
+
98dfabf6c25d0f24d36634662acdc2a563c416f0 refs/tags/v0.0.3
|
4
|
+
c00b69089693056bb7952fbcfd8b7cda26cc9728 refs/tags/v0.1.0
|
5
|
+
ce69096b1048d88b73bd4cf5fe29351b65e393da refs/tags/v0.1.1
|
6
|
+
7ee35a495d657dfb96969a2a206f6a133ea0bb91 refs/tags/v0.1.2
|
7
|
+
8cbe67806ba30a85a05d9eeaf1377dc819d98595 refs/tags/v1.0.0
|
8
|
+
5ac529b73f7f1e2329c1458b0fe200ea1fafd55b refs/tags/v1.0.1
|
9
|
+
6aa287ee9dfd18704446c6fedbdf653cd5add783 refs/tags/v1.0.3
|
@@ -0,0 +1 @@
|
|
1
|
+
b4c93197e40d3c2b38d06f316bfb1fd5f0a120de
|
@@ -0,0 +1 @@
|
|
1
|
+
a98d27d5b4f16de29bd3bf9c486d25b14d5960c3
|
@@ -0,0 +1 @@
|
|
1
|
+
b4c93197e40d3c2b38d06f316bfb1fd5f0a120de
|
@@ -0,0 +1 @@
|
|
1
|
+
10332b013b911516b20c344f933aadafefc9b752
|
@@ -0,0 +1 @@
|
|
1
|
+
a98d27d5b4f16de29bd3bf9c486d25b14d5960c3
|
@@ -0,0 +1 @@
|
|
1
|
+
b4c93197e40d3c2b38d06f316bfb1fd5f0a120de
|
@@ -0,0 +1 @@
|
|
1
|
+
f09f1b803ab437ec9e31d28560df03add6944308
|
@@ -0,0 +1,58 @@
|
|
1
|
+
require "vagrant-windows/config/windows"
|
2
|
+
require "vagrant-windows/config/winrm"
|
3
|
+
|
4
|
+
describe VagrantWindows::Config::Windows do
|
5
|
+
let(:instance) { described_class.new }
|
6
|
+
|
7
|
+
describe "defaults" do
|
8
|
+
subject do
|
9
|
+
instance.tap do |o|
|
10
|
+
o.finalize!
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
its("halt_timeout") { should == 30 }
|
15
|
+
its("halt_check_interval") { should == 1 }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe "overriding defaults" do
|
19
|
+
[:halt_timeout, :halt_check_interval].each do |attribute|
|
20
|
+
it "should not default #{attribute} if overridden" do
|
21
|
+
instance.send("#{attribute}=".to_sym, 10)
|
22
|
+
instance.finalize!
|
23
|
+
instance.send(attribute).should == 10
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
describe VagrantWindows::Config::WinRM do
|
31
|
+
let(:instance) { described_class.new }
|
32
|
+
|
33
|
+
describe "defaults" do
|
34
|
+
subject do
|
35
|
+
instance.tap do |o|
|
36
|
+
o.finalize!
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
its("username") { should == "vagrant" }
|
41
|
+
its("password") { should == "vagrant" }
|
42
|
+
its("host") { should == "localhost" }
|
43
|
+
its("port") { should == 5985 }
|
44
|
+
its("guest_port") { should == 5985 }
|
45
|
+
its("max_tries") { should == 20 }
|
46
|
+
its("timeout") { should == 1800 }
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "overriding defaults" do
|
50
|
+
[:username, :password, :host, :port, :guest_port, :max_tries, :timeout].each do |attribute|
|
51
|
+
it "should not default #{attribute} if overridden" do
|
52
|
+
instance.send("#{attribute}=".to_sym, 10)
|
53
|
+
instance.finalize!
|
54
|
+
instance.send(attribute).should == 10
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require "vagrant-windows/communication/guestnetwork"
|
2
|
+
require "vagrant-windows/communication/winrmshell"
|
3
|
+
|
4
|
+
describe VagrantWindows::Communication::GuestNetwork do
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
# This test requires you already have a running Windows Server 2008 R2 Vagrant VM
|
8
|
+
# Not ideal, but you have to start somewhere
|
9
|
+
@shell = VagrantWindows::Communication::WinRMShell.new("localhost", "vagrant", "vagrant")
|
10
|
+
@guestnetwork = VagrantWindows::Communication::GuestNetwork.new(@shell)
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "wsman_version" do
|
14
|
+
it "network_adapters" do
|
15
|
+
nics = @guestnetwork.network_adapters()
|
16
|
+
#puts nics.pretty_inspect()
|
17
|
+
|
18
|
+
expect(nics.count).to be >= 1
|
19
|
+
nic = nics[0]
|
20
|
+
|
21
|
+
expect(nic.has_key?(:mac_address)).to be_true
|
22
|
+
expect(nic.has_key?(:net_connection_id)).to be_true
|
23
|
+
expect(nic.has_key?(:interface_index)).to be_true
|
24
|
+
expect(nic.has_key?(:index)).to be_true
|
25
|
+
|
26
|
+
expect(nic[:mac_address]).to match(/^([0-9A-F]{2}[:]){5}([0-9A-F]{2})$/)
|
27
|
+
Integer(nic[:interface_index])
|
28
|
+
Integer(nic[:index])
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should configure DHCP for adapter" do
|
32
|
+
nics = @guestnetwork.network_adapters()
|
33
|
+
@guestnetwork.configure_dhcp_interface(nics[0][:index], nics[0][:net_connection_id])
|
34
|
+
expect(@guestnetwork.is_dhcp_enabled(nics[0][:index])).to be_true
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should configure static IP for adapter" do
|
38
|
+
nics = @guestnetwork.network_adapters()
|
39
|
+
@guestnetwork.configure_static_interface(nics[1][:index], nics[1][:net_connection_id], "192.168.0.100", "255.255.255.0")
|
40
|
+
expect(@guestnetwork.is_dhcp_enabled(nics[1][:index])).to be_false
|
41
|
+
end
|
42
|
+
|
43
|
+
it "should configure all networks to work mode" do
|
44
|
+
@guestnetwork.set_all_networks_to_work()
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require "vagrant-windows/helper"
|
2
|
+
|
3
|
+
describe VagrantWindows::Helper do
|
4
|
+
|
5
|
+
class DummyHelper
|
6
|
+
include VagrantWindows::Helper
|
7
|
+
end
|
8
|
+
|
9
|
+
before(:all) do
|
10
|
+
@dummy = DummyHelper.new
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "win_friendly_path" do
|
14
|
+
it "should replace slashes with backslashes" do
|
15
|
+
@dummy.win_friendly_path('c:/tmp/dir').should eq('c:\\tmp\\dir')
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should prepend c: drive if not drive specified" do
|
19
|
+
@dummy.win_friendly_path('/tmp/dir').should eq('c:\\tmp\\dir')
|
20
|
+
end
|
21
|
+
|
22
|
+
it "should return nil if no path specified" do
|
23
|
+
@dummy.win_friendly_path(nil).should be_nil
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
describe "win_friendly_share_id" do
|
28
|
+
it "should use share id if present" do
|
29
|
+
@dummy.win_friendly_share_id('sharename').should eq('sharename')
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should use last folder name in guest_path" do
|
33
|
+
@dummy.win_friendly_share_id('/tmp/folder/sharename').should eq('tmp_folder_sharename')
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "vagrant-windows/communication/guestnetwork"
|
2
|
+
require "vagrant-windows/communication/winrmshell"
|
3
|
+
|
4
|
+
describe VagrantWindows::Communication::WinRMCommunicator do
|
5
|
+
|
6
|
+
before(:all) do
|
7
|
+
# This test requires you already have a running Windows Server 2008 R2 Vagrant VM
|
8
|
+
# Not ideal, but you have to start somewhere
|
9
|
+
@shell = VagrantWindows::Communication::WinRMShell.new("localhost", "vagrant", "vagrant")
|
10
|
+
@communicator = VagrantWindows::Communication::WinRMCommunicator.new({})
|
11
|
+
@communicator.set_winrmshell(@shell)
|
12
|
+
end
|
13
|
+
|
14
|
+
describe "execute" do
|
15
|
+
it "should return 1" do
|
16
|
+
expect(@communicator.execute("exit 1")).to eq(1)
|
17
|
+
end
|
18
|
+
|
19
|
+
it "should return 1 with block" do
|
20
|
+
exit_code = @communicator.sudo("exit 1", {}) do |type, line|
|
21
|
+
puts line
|
22
|
+
end
|
23
|
+
expect(exit_code).to eq(1)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
require File.expand_path('../lib/vagrant-plugin-dummy/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.authors = ["Bryan Bishop"]
|
6
|
+
gem.email = ["kanzure@gmail.com"]
|
7
|
+
gem.description = %q{Dummy Guest Support for Vagrant}
|
8
|
+
gem.summary = %q{A small gem that adds dummy guest support to vagrant, basically no vagrant features}
|
9
|
+
gem.homepage = "https://github.com/kanzure/vagrant-plugin-dummy"
|
10
|
+
|
11
|
+
# The following block of code determines the files that should be included
|
12
|
+
# in the gem. It does this by reading all the files in the directory where
|
13
|
+
# this gemspec is, and parsing out the ignored files from the gitignore.
|
14
|
+
# Note that the entire gitignore(5) syntax is not supported, specifically
|
15
|
+
# the "!" syntax, but it should mostly work correctly.
|
16
|
+
root_path = File.dirname(__FILE__)
|
17
|
+
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
18
|
+
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
19
|
+
gitignore_path = File.join(root_path, ".gitignore")
|
20
|
+
gitignore = File.readlines(gitignore_path)
|
21
|
+
gitignore.map! { |line| line.chomp.strip }
|
22
|
+
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
23
|
+
|
24
|
+
unignored_files = all_files.reject do |file|
|
25
|
+
# Ignore any directories, the gemspec only cares about files
|
26
|
+
next true if File.directory?(file)
|
27
|
+
|
28
|
+
# Ignore any paths that match anything in the gitignore. We do
|
29
|
+
# two tests here:
|
30
|
+
#
|
31
|
+
# - First, test to see if the entire path matches the gitignore.
|
32
|
+
# - Second, match if the basename does, this makes it so that things
|
33
|
+
# like '.DS_Store' will match sub-directories too (same behavior
|
34
|
+
# as git).
|
35
|
+
#
|
36
|
+
gitignore.any? do |ignore|
|
37
|
+
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
38
|
+
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
gem.files = unignored_files
|
43
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
44
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
45
|
+
gem.name = "vagrant-plugin-dummy"
|
46
|
+
gem.require_paths = ["lib"]
|
47
|
+
gem.version = VagrantPluginDummy::VERSION
|
48
|
+
|
49
|
+
gem.add_development_dependency "rake"
|
50
|
+
gem.add_development_dependency "rspec-core", "~> 2.12.2"
|
51
|
+
gem.add_development_dependency "rspec-expectations", "~> 2.12.1"
|
52
|
+
gem.add_development_dependency "rspec-mocks", "~> 2.12.1"
|
53
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require 'log4r'
|
2
|
+
require_relative '../../vagrant-windows'
|
3
|
+
require_relative '../communication/winrmshell'
|
4
|
+
require_relative '../errors'
|
5
|
+
|
6
|
+
module VagrantWindows
|
7
|
+
module Communication
|
8
|
+
|
9
|
+
# Manages the remote Windows guest network
|
10
|
+
class GuestNetwork
|
11
|
+
|
12
|
+
PS_GET_WSMAN_VER = '((test-wsman).productversion.split(" ") | select -last 1).split("\.")[0]'
|
13
|
+
WQL_NET_ADAPTERS_V2 = 'SELECT * FROM Win32_NetworkAdapter WHERE MACAddress IS NOT NULL'
|
14
|
+
|
15
|
+
attr_reader :logger
|
16
|
+
attr_reader :winrmshell
|
17
|
+
|
18
|
+
def initialize(winrmshell)
|
19
|
+
@logger = Log4r::Logger.new("vagrant_windows::communication::winrmshell")
|
20
|
+
@logger.debug("initializing WinRMShell")
|
21
|
+
@winrmshell = winrmshell
|
22
|
+
end
|
23
|
+
|
24
|
+
# Returns an array of all NICs on the guest. Each array entry is a
|
25
|
+
# Hash of the NICs properties.
|
26
|
+
#
|
27
|
+
# @return [Array]
|
28
|
+
def network_adapters()
|
29
|
+
wsman_version() == 2? network_adapters_v2_winrm() : network_adapters_v3_winrm()
|
30
|
+
end
|
31
|
+
|
32
|
+
# Checks to see if the specified NIC is currently configured for DHCP.
|
33
|
+
#
|
34
|
+
# @return [Boolean]
|
35
|
+
def is_dhcp_enabled(nic_index)
|
36
|
+
has_dhcp_enabled = false
|
37
|
+
cmd = "Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter \"Index=#{nic_index} and DHCPEnabled=True\""
|
38
|
+
@winrmshell.powershell(cmd) do |type, line|
|
39
|
+
has_dhcp_enabled = !line.nil?
|
40
|
+
end
|
41
|
+
@logger.debug("NIC #{nic_index} has DHCP enabled: #{has_dhcp_enabled}")
|
42
|
+
has_dhcp_enabled
|
43
|
+
end
|
44
|
+
|
45
|
+
# Configures the specified interface for DHCP
|
46
|
+
#
|
47
|
+
# @param [Integer] The interface index.
|
48
|
+
# @param [String] The unique name of the NIC, such as 'Local Area Connection'.
|
49
|
+
def configure_dhcp_interface(nic_index, net_connection_id)
|
50
|
+
@logger.info("Configuring NIC #{net_connection_id} for DHCP")
|
51
|
+
if !is_dhcp_enabled(nic_index)
|
52
|
+
netsh = "netsh interface ip set address \"#{net_connection_id}\" dhcp"
|
53
|
+
@winrmshell.powershell(netsh)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# Configures the specified interface using a static address
|
58
|
+
#
|
59
|
+
# @param [Integer] The interface index.
|
60
|
+
# @param [String] The unique name of the NIC, such as 'Local Area Connection'.
|
61
|
+
# @param [String] The static IP address to assign to the specified NIC.
|
62
|
+
# @param [String] The network mask to use with the static IP.
|
63
|
+
def configure_static_interface(nic_index, net_connection_id, ip, netmask)
|
64
|
+
@logger.info("Configuring NIC #{net_connection_id} using static ip #{ip}")
|
65
|
+
#netsh interface ip set address "Local Area Connection 2" static 192.168.33.10 255.255.255.0
|
66
|
+
netsh = "netsh interface ip set address \"#{net_connection_id}\" static #{ip} #{netmask}"
|
67
|
+
@winrmshell.powershell(netsh)
|
68
|
+
end
|
69
|
+
|
70
|
+
# Sets all networks on the guest to 'Work Network' mode. This is
|
71
|
+
# to allow guest access from the host via a private IP on Win7
|
72
|
+
# https://github.com/WinRb/vagrant-windows/issues/63
|
73
|
+
def set_all_networks_to_work()
|
74
|
+
@logger.info("Setting all networks to 'Work Network'")
|
75
|
+
command = VagrantWindows.load_script("set_work_network.ps1")
|
76
|
+
@winrmshell.powershell(command)
|
77
|
+
end
|
78
|
+
|
79
|
+
|
80
|
+
protected
|
81
|
+
|
82
|
+
# Checks the WinRS version on the guest. Usually 2 on Windows 7/2008
|
83
|
+
# and 3 on Windows 8/2012.
|
84
|
+
#
|
85
|
+
# @return [Integer]
|
86
|
+
def wsman_version()
|
87
|
+
@logger.debug("querying WSMan version")
|
88
|
+
version = ''
|
89
|
+
@winrmshell.powershell(PS_GET_WSMAN_VER) do |type, line|
|
90
|
+
version = version + "#{line}" if type == :stdout && !line.nil?
|
91
|
+
end
|
92
|
+
@logger.debug("wsman version: #{version}")
|
93
|
+
Integer(version)
|
94
|
+
end
|
95
|
+
|
96
|
+
# Returns an array of all NICs on the guest. Each array entry is a
|
97
|
+
# Hash of the NICs properties. This method should only be used on
|
98
|
+
# guests that have WinRS version 2.
|
99
|
+
#
|
100
|
+
# @return [Array]
|
101
|
+
def network_adapters_v2_winrm()
|
102
|
+
@logger.debug("querying network adapters")
|
103
|
+
# Get all NICs that have a MAC address
|
104
|
+
# http://msdn.microsoft.com/en-us/library/windows/desktop/aa394216(v=vs.85).aspx
|
105
|
+
adapters = @winrmshell.wql(WQL_NET_ADAPTERS_V2)[:win32_network_adapter]
|
106
|
+
@logger.debug("#{adapters.inspect}")
|
107
|
+
return adapters
|
108
|
+
end
|
109
|
+
|
110
|
+
# Returns an array of all NICs on the guest. Each array entry is a
|
111
|
+
# Hash of the NICs properties. This method should only be used on
|
112
|
+
# guests that have WinRS version 3.
|
113
|
+
#
|
114
|
+
# This method is a workaround until the WinRM gem supports WinRS version 3.
|
115
|
+
#
|
116
|
+
# @return [Array]
|
117
|
+
def network_adapters_v3_winrm()
|
118
|
+
winrs_v3_get_adapters_ps1 = VagrantWindows.load_script("winrs_v3_get_adapters.ps1")
|
119
|
+
output = ''
|
120
|
+
@winrmshell.powershell(winrs_v3_get_adapters_ps1) do |type, line|
|
121
|
+
output = output + "#{line}" if type == :stdout && !line.nil?
|
122
|
+
end
|
123
|
+
adapters = []
|
124
|
+
JSON.parse(output).each do |nic|
|
125
|
+
adapters << nic.inject({}){ |memo,(k,v)| memo[k.to_sym] = v; memo }
|
126
|
+
end
|
127
|
+
@logger.debug("#{adapters.inspect}")
|
128
|
+
return adapters
|
129
|
+
end
|
130
|
+
|
131
|
+
end #GuestNetwork class
|
132
|
+
end
|
133
|
+
end
|