Commit graph

54 commits

Author SHA1 Message Date
Dominik Richter
ae10fefd15 fix warnings 2015-10-01 16:43:36 +02:00
Dominik Richter
12888c8dad bugfix: centos detection in docker centos:7.1.1503
It doesnt post the expected information in /etc/redhat-release:

    Derived from Red Hat Enterprise Linux 7.1 (Source)

Additionally in /etc/os-release:

    NAME="CentOS Linux"
	  VERSION="7 (Core)"
	  ...

Combine both files to fix the detection.
2015-09-30 13:44:24 +02:00
Dominik Richter
90de8763cf wrap up linting
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-30 02:20:47 +02:00
Dominik Richter
212f11243b simplify and fix stat handling
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-30 01:42:04 +02:00
Dominik Richter
3508201a5d split out unix stat
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-29 19:18:48 +02:00
Dominik Richter
78d98388f8 add amazon scientific and xenserver to redhat distros in detection
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-28 12:46:46 +02:00
Dominik Richter
4e15e425a4 move darwin to bsd type
see: https://en.wikipedia.org/wiki/Darwin_%28operating_system%29#/media/File:Unix_timeline.en.svg
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-28 12:14:40 +02:00
Dominik Richter
4f0c0d7f21 add unit tests to os common detection
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-28 11:52:50 +02:00
Dominik Richter
7019b1f659 generalize and simplify os detect methods
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-28 11:15:41 +02:00
Dominik Richter
2eb94f5e2e be more explicit about detecting unix
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-28 11:06:38 +02:00
Dominik Richter
bc98b3330f feature: add helpers for OS families
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-28 11:06:38 +02:00
Dominik Richter
093600b85f split up os detection for linting
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-26 13:12:52 +02:00
Dominik Richter
1e5fc59fa8 bugfix: handle selinux label (null)
Return nil instead of (null), as it is a special output of stat.
2015-09-24 10:36:21 +02:00
Dominik Richter
7a6675394c bugfix: linux file dont return selinux label ?
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-24 10:36:21 +02:00
Dominik Richter
3ed1c29039 bugfix: linux file content for folder/missing
Dont return empty strings when reading a directory or if the path doesnt exist. Instead return nil.

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-24 10:36:21 +02:00
Christoph Hartmann
52f7ddd899 add comment windows version determination 2015-09-23 13:24:55 +02:00
Christoph Hartmann
18e420bb31 remove windows 2003 r2, shares the same version number as windows 2003, only distinguishes via build number 2015-09-23 13:23:03 +02:00
Dominik Richter
ab155f7db6 bugfix: windows server 2008 detection
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-23 10:38:46 +02:00
Dominik Richter
7ccd88f1a2 improvement: os detection on unix
provided the platform family hint == "unix" run tests for all supported unix systems
also clarify the role of linux detection as the last step

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 19:43:11 +02:00
Dominik Richter
a9c129540b bugfix: file common for linked_to? tests
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 19:43:11 +02:00
Dominik Richter
5fec383788 bugfix: detect os via unames
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 16:25:17 +02:00
Dominik Richter
0b7eb60028 File.exists? is deprecated in ruby 2.1
See:
http://ruby-doc.org/core-2.1.0/File.html#method-c-exists-3F

Same for Dir:
http://ruby-doc.org/core-2.1.0/Dir.html#method-c-exists-3F

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:03 +02:00
Dominik Richter
13f7429509 remove commented fedora code
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:03 +02:00
Dominik Richter
e78fbf1b96 move windows OS detection to backend
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:02 +02:00
Dominik Richter
f0215a4380 specinfra backwards compatibility for darwin/osX
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:02 +02:00
Dominik Richter
0ed2f1b535 fix inverted darwin detection
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:02 +02:00
Dominik Richter
50dd82e150 feature: OS detection 2015-09-22 02:27:02 +02:00
Dominik Richter
61e7559489 fix bsd stat detection
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:00 +02:00
Dominik Richter
a1a0e10c5a extend linux file with bsd stat
TODO: we must start separating between the different UNIXes and maybe call this something better than LinuxFile, but for now: since most of the things will stay the same, add the bsd stat command as an alternative to the linux stat command and parse its output.
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:27:00 +02:00
Dominik Richter
7137a9625b expose backend file path
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:26:58 +02:00
Dominik Richter
4aef4821cc bugfix: target_type check for pipe
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:25:52 +02:00
Dominik Richter
d8dea86e6e api: return nil for md5/sha256/content empty
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:17:30 +02:00
Dominik Richter
2c00423c3e read symlink destination file types
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:17:30 +02:00
Dominik Richter
3e16407454 rename file link_target -> link_path
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:17:30 +02:00
Dominik Richter
04a8cfddf4 ignore exit code on linux stat
For now: Since stat throws exit code 1 on selinux label checks if no selinux label (or system) is present, it would signal us to disregard results. However, the results are actually complete and can be fully used, with selinux_label becoming "?".

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:17:29 +02:00
Dominik Richter
3e02e622c5 bugfix: linux file stat parameters and mount
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:15:43 +02:00
Dominik Richter
cfbd5ccfc0 lint plugins
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:15:42 +02:00
Dominik Richter
e3373679ec feature: add docker container backend
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:15:41 +02:00
Dominik Richter
275039dead more rubocop
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:15:41 +02:00
Dominik Richter
13bc7f4015 move linux file handling to separate class
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 02:15:40 +02:00
Dominik Richter
0125bcace8 add call tracing to mock backend
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 01:42:26 +02:00
Dominik Richter
17386740c7 dont redefine classmethod on initialize
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 01:23:08 +02:00
Dominik Richter
cb5f2d4409 bugfix: inherit base methods
Don't redefine methods that aren't there yet. yes: ruby parses top down at at that point we don't have these methods yet anyway, so don't :send them to the class

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-22 01:23:08 +02:00
Christoph Hartmann
0e8651bf26 fix rubocop issues 2015-09-05 16:07:54 +02:00
Christoph Hartmann
bbbb8380ca replace raise with fail 2015-09-03 23:24:42 +02:00
Dominik Richter
c9fcb2913a complete all file tests
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-03 16:17:52 +02:00
Dominik Richter
29a143a67f remove file ctime
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-03 15:43:30 +02:00
Dominik Richter
199cb84ab3 not implemented only throws on missing methods
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-02 17:30:49 +02:00
Dominik Richter
1c2ab098f5 specify methods all backends must implement
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-02 11:53:25 +02:00
Dominik Richter
05b4167971 start backend and file tests
Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
2015-09-02 04:55:22 +02:00