deep_duplicate hashes for selinux label tests

Signed-off-by: Dominik Richter <dominik.richter@gmail.com>
This commit is contained in:
Dominik Richter 2015-09-16 12:11:23 +02:00
parent 9521653f54
commit 50f3103358

View file

@ -11,6 +11,10 @@ module Test
60 * 60 * 24 * 1 60 * 60 * 24 * 1
end end
def dup(o)
Marshal.load(Marshal.dump(o))
end
def selinux_label(os, path = nil) def selinux_label(os, path = nil)
labels = {} labels = {}
@ -19,14 +23,17 @@ module Test
h['redhat'] = {} h['redhat'] = {}
h['redhat'].default = 'unconfined_u:object_r:user_tmp_t:s0' h['redhat'].default = 'unconfined_u:object_r:user_tmp_t:s0'
h['redhat']['5.11'] = 'user_u:object_r:tmp_t' h['redhat']['5.11'] = 'user_u:object_r:tmp_t'
labels.default = h.dup labels.default = dup(h)
h['redhat'].default = 'unconfined_u:object_r:tmp_t:s0'
labels['/tmp/block_device'] = dup(h)
h = {} h = {}
h.default = Hash.new(nil) h.default = Hash.new(nil)
h['redhat'] = {} h['redhat'] = {}
h['redhat'].default = 'system_u:object_r:null_device_t:s0' h['redhat'].default = 'system_u:object_r:null_device_t:s0'
h['redhat']['5.11'] = 'system_u:object_r:null_device_t' h['redhat']['5.11'] = 'system_u:object_r:null_device_t'
labels['/dev/null'] = h.dup labels['/dev/null'] = dup(h)
labels[path][os[:family]][os[:release]] labels[path][os[:family]][os[:release]]
end end