facter 1.7.2 → 1.7.3.rc1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of facter might be problematic. Click here for more details.

Files changed (45) hide show
  1. data/README.md +8 -0
  2. data/Rakefile +10 -4
  3. data/ext/build_defaults.yaml +4 -3
  4. data/ext/debian/changelog.erb +7 -1
  5. data/ext/debian/control +2 -2
  6. data/ext/redhat/facter.spec.erb +1 -1
  7. data/install.rb +1 -1
  8. data/lib/facter/domain.rb +11 -3
  9. data/lib/facter/hardwaremodel.rb +7 -2
  10. data/lib/facter/ipaddress.rb +16 -4
  11. data/lib/facter/ipaddress6.rb +12 -3
  12. data/lib/facter/macaddress.rb +1 -1
  13. data/lib/facter/netmask.rb +19 -0
  14. data/lib/facter/util/directory_loader.rb +1 -1
  15. data/lib/facter/util/ip.rb +14 -18
  16. data/lib/facter/util/ip/windows.rb +215 -0
  17. data/lib/facter/util/macaddress.rb +3 -9
  18. data/lib/facter/util/netmask.rb +1 -1
  19. data/lib/facter/util/parser.rb +30 -19
  20. data/lib/facter/version.rb +1 -1
  21. data/lib/facter/virtual.rb +5 -5
  22. data/spec/fixtures/unit/ipaddress/ifconfig_non_english_locale.txt +18 -0
  23. data/spec/lib/facter_spec/windows_network.rb +64 -0
  24. data/spec/spec_helper.rb +25 -7
  25. data/spec/unit/architecture_spec.rb +1 -0
  26. data/spec/unit/domain_spec.rb +37 -6
  27. data/spec/unit/ec2_spec.rb +1 -1
  28. data/spec/unit/facter_spec.rb +2 -2
  29. data/spec/unit/hardwaremodel_spec.rb +16 -1
  30. data/spec/unit/ipaddress6_spec.rb +106 -13
  31. data/spec/unit/ipaddress_spec.rb +100 -22
  32. data/spec/unit/macaddress_spec.rb +0 -4
  33. data/spec/unit/memory_spec.rb +8 -7
  34. data/spec/unit/netmask_spec.rb +62 -5
  35. data/spec/unit/util/ip/windows_spec.rb +48 -0
  36. data/spec/unit/util/ip_spec.rb +9 -21
  37. data/spec/unit/util/macaddress_spec.rb +52 -10
  38. data/spec/unit/util/parser_spec.rb +32 -3
  39. data/spec/unit/util/virtual_spec.rb +9 -4
  40. data/spec/unit/zfs_version_spec.rb +4 -5
  41. data/spec/unit/zpool_version_spec.rb +4 -5
  42. metadata +480 -477
  43. data/ext/osx/PackageInfo.plist +0 -36
  44. data/ext/osx/createpackage.sh +0 -179
  45. data/spec/fixtures/netsh/windows_netsh_addresses_with_multiple_interfaces +0 -35
@@ -1,36 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>CFBundleIdentifier</key>
6
- <string>com.reductivelabs.facter</string>
7
- <key>CFBundleShortVersionString</key>
8
- <string>{SHORTVERSION}</string>
9
- <key>IFMajorVersion</key>
10
- <integer>{MAJORVERSION}</integer>
11
- <key>IFMinorVersion</key>
12
- <integer>{MINORVERSION}</integer>
13
- <key>IFPkgFlagAllowBackRev</key>
14
- <false/>
15
- <key>IFPkgFlagAuthorizationAction</key>
16
- <string>RootAuthorization</string>
17
- <key>IFPkgFlagDefaultLocation</key>
18
- <string>/</string>
19
- <key>IFPkgFlagFollowLinks</key>
20
- <true/>
21
- <key>IFPkgFlagInstallFat</key>
22
- <false/>
23
- <key>IFPkgFlagIsRequired</key>
24
- <false/>
25
- <key>IFPkgFlagOverwritePermissions</key>
26
- <false/>
27
- <key>IFPkgFlagRelocatable</key>
28
- <false/>
29
- <key>IFPkgFlagRestartAction</key>
30
- <string>None</string>
31
- <key>IFPkgFlagRootVolumeOnly</key>
32
- <true/>
33
- <key>IFPkgFlagUpdateInstalledLanguages</key>
34
- <false/>
35
- </dict>
36
- </plist>
@@ -1,179 +0,0 @@
1
- #!/bin/bash
2
- #
3
- # Script to build an "old style" not flat pkg out of the facter repository.
4
- #
5
- # Author: Nigel Kersten (nigelk@google.com)
6
- #
7
- # Last Updated: 2008-07-31
8
- #
9
- # Copyright 2008 Google Inc.
10
- #
11
- # Licensed under the Apache License, Version 2.0 (the "License");
12
- # you may not use this file except in compliance with the License.
13
- # You may obtain a copy of the License at
14
- #
15
- # http://www.apache.org/licenses/LICENSE-2.0
16
- #
17
- # Unless required by applicable law or agreed to in writing, software
18
- # distributed under the License is distributed on an "AS IS" BASIS,
19
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20
- # See the License for the specific language governing permissions and
21
- # limitations under the License
22
-
23
-
24
- INSTALLRB="install.rb"
25
- BINDIR="/usr/bin"
26
- SITELIBDIR="/usr/lib/ruby/site_ruby/1.8"
27
- PACKAGEMAKER="/Developer/usr/bin/packagemaker"
28
- PROTO_PLIST="PackageInfo.plist"
29
- PREFLIGHT="preflight"
30
-
31
-
32
- function find_installer() {
33
- # we walk up three directories to make this executable from the root,
34
- # root/conf or root/conf/osx
35
- if [ -f "./${INSTALLRB}" ]; then
36
- installer="$(pwd)/${INSTALLRB}"
37
- elif [ -f "../${INSTALLRB}" ]; then
38
- installer="$(pwd)/../${INSTALLRB}"
39
- elif [ -f "../../${INSTALLRB}" ]; then
40
- installer="$(pwd)/../../${INSTALLRB}"
41
- else
42
- installer=""
43
- fi
44
- }
45
-
46
- function find_facter_root() {
47
- facter_root=$(dirname "${installer}")
48
- }
49
-
50
- function install_facter() {
51
- echo "Installing Facter to ${pkgroot}"
52
- cd "$facter_root"
53
- ./"${INSTALLRB}" --destdir="${pkgroot}" --bindir="${BINDIR}" --sitelibdir="${SITELIBDIR}"
54
- chown -R root:admin "${pkgroot}"
55
- }
56
-
57
- function install_docs() {
58
- echo "Installing docs to ${pkgroot}"
59
- docdir="${pkgroot}/usr/share/doc/facter"
60
- mkdir -p "${docdir}"
61
- for docfile in ChangeLog COPYING LICENSE README README.rst TODO; do
62
- install -m 0644 "${facter_root}/${docfile}" "${docdir}"
63
- done
64
- chown -R root:wheel "${docdir}"
65
- chmod 0755 "${docdir}"
66
- }
67
-
68
- function get_facter_version() {
69
- facter_version=$(RUBYLIB="${pkgroot}/${SITELIBDIR}:${RUBYLIB}" ruby -e "require 'facter'; puts Facter.version")
70
- }
71
-
72
- function prepare_package() {
73
- # As we can't specify to follow symlinks from the command line, we have
74
- # to go through the hassle of creating an Info.plist file for packagemaker
75
- # to look at for package creation and substitue the version strings out.
76
- # Major/Minor versions can only be integers, so we have "1" and "50" for
77
- # facter version 1.5
78
- # Note too that for 10.5 compatibility this Info.plist *must* be set to
79
- # follow symlinks.
80
- VER1=$(echo ${facter_version} | awk -F "." '{print $1}')
81
- VER2=$(echo ${facter_version} | awk -F "." '{print $2}')
82
- VER3=$(echo ${facter_version} | awk -F "." '{print $3}')
83
- major_version="${VER1}"
84
- minor_version="${VER2}${VER3}"
85
- cp "${facter_root}/conf/osx/${PROTO_PLIST}" "${pkgtemp}"
86
- sed -i '' "s/{SHORTVERSION}/${facter_version}/g" "${pkgtemp}/${PROTO_PLIST}"
87
- sed -i '' "s/{MAJORVERSION}/${major_version}/g" "${pkgtemp}/${PROTO_PLIST}"
88
- sed -i '' "s/{MINORVERSION}/${minor_version}/g" "${pkgtemp}/${PROTO_PLIST}"
89
-
90
- # We need to create a preflight script to remove traces of previous
91
- # facter installs due to limitations in Apple's pkg format.
92
- mkdir "${pkgtemp}/scripts"
93
- cp "${facter_root}/conf/osx/${PREFLIGHT}" "${pkgtemp}/scripts"
94
-
95
- # substitute in the sitelibdir specified above on the assumption that this
96
- # is where any previous facter install exists that should be cleaned out.
97
- sed -i '' "s|{SITELIBDIR}|${SITELIBDIR}|g" "${pkgtemp}/scripts/${PREFLIGHT}"
98
- chmod 0755 "${pkgtemp}/scripts/${PREFLIGHT}"
99
- }
100
-
101
- function create_package() {
102
- rm -fr "$(pwd)/facter-${facter_version}.pkg"
103
- echo "Building package"
104
- echo "Note that packagemaker is reknowned for spurious errors. Don't panic."
105
- "${PACKAGEMAKER}" --root "${pkgroot}" \
106
- --info "${pkgtemp}/${PROTO_PLIST}" \
107
- --scripts ${pkgtemp}/scripts \
108
- --out "$(pwd)/facter-${facter_version}.pkg"
109
- if [ $? -ne 0 ]; then
110
- echo "There was a problem building the package."
111
- cleanup_and_exit 1
112
- exit 1
113
- else
114
- echo "The package has been built at:"
115
- echo "$(pwd)/facter-${facter_version}.pkg"
116
- fi
117
- }
118
-
119
- function cleanup_and_exit() {
120
- if [ -d "${pkgroot}" ]; then
121
- rm -fr "${pkgroot}"
122
- fi
123
- if [ -d "${pkgtemp}" ]; then
124
- rm -fr "${pkgtemp}"
125
- fi
126
- exit $1
127
- }
128
-
129
- # Program entry point
130
- function main() {
131
-
132
- if [ $(whoami) != "root" ]; then
133
- echo "This script needs to be run as root via su or sudo."
134
- cleanup_and_exit 1
135
- fi
136
-
137
- find_installer
138
-
139
- if [ ! "${installer}" ]; then
140
- echo "Unable to find ${INSTALLRB}"
141
- cleanup_and_exit 1
142
- fi
143
-
144
- find_facter_root
145
-
146
- if [ ! "${facter_root}" ]; then
147
- echo "Unable to find facter repository root."
148
- cleanup_and_exit 1
149
- fi
150
-
151
- pkgroot=$(mktemp -d -t facterpkg)
152
-
153
- if [ ! "${pkgroot}" ]; then
154
- echo "Unable to create temporary package root."
155
- cleanup_and_exit 1
156
- fi
157
-
158
- pkgtemp=$(mktemp -d -t factertmp)
159
-
160
- if [ ! "${pkgtemp}" ]; then
161
- echo "Unable to create temporary package root."
162
- cleanup_and_exit 1
163
- fi
164
-
165
- install_facter
166
- get_facter_version
167
-
168
- if [ ! "${facter_version}" ]; then
169
- echo "Unable to retrieve facter version"
170
- cleanup_and_exit 1
171
- fi
172
-
173
- prepare_package
174
- create_package
175
-
176
- cleanup_and_exit 0
177
- }
178
-
179
- main "$@"
@@ -1,35 +0,0 @@
1
- Address ::1 Parameters
2
- ---------------------------------------------------------
3
- Interface Luid : Loopback Pseudo-Interface 1
4
- Scope Id : 0.0
5
- Valid Lifetime : infinite
6
- Preferred Lifetime : infinite
7
- DAD State : Preferred
8
- Address Type : Other
9
-
10
- Address fe80::7128:aa90:8f2a:8375%9 Parameters
11
- ---------------------------------------------------------
12
- Interface Luid : Local Area Connection
13
- Scope Id : 0.9
14
- Valid Lifetime : infinite
15
- Preferred Lifetime : infinite
16
- DAD State : Preferred
17
- Address Type : Other
18
-
19
- Address fe80::5efe:172.16.138.216%11 Parameters
20
- ---------------------------------------------------------
21
- Interface Luid : isatap.localdomain
22
- Scope Id : 0.11
23
- Valid Lifetime : infinite
24
- Preferred Lifetime : infinite
25
- DAD State : Deprecated
26
- Address Type : Other
27
-
28
- Address 2001:0:4137:9e76:2087:77a:53ef:7527 Parameters
29
- ---------------------------------------------------------
30
- Interface Luid : Teredo Tunneling Pseudo-Interface
31
- Scope Id : 0.0
32
- Valid Lifetime : infinite
33
- Preferred Lifetime : infinite
34
- DAD State : Preferred
35
- Address Type : Public