Test_Semanage - Augeas Documentation

# Test_Semanage

Provides unit tests and examples for the Semanage lens.

Summary

Test_Semanage | Provides unit tests and examples for the Semanage lens.
Augeas Variables |
phony_conf |
Augeas Tests |
Semanage.lns |
Semanage.lns | Quotes are OK in variables that do not begin with a quote
Semanage.lns | Support empty values
Augeas Variables |
conf |
Augeas Tests |
Semanage.lns |

### Augeas Variables

### phony_conf

> let phony_conf = "# this is a comment mykey = myvalue # eol comment anotherkey = another value "

### Augeas Tests

### Semanage.lns

> test Semanage.lns get phony_conf = { "#comment" = "this is a comment" } { } { "mykey" = "myvalue" { "#comment" = "eol comment" } } { "anotherkey" = "another value" }

### Semanage.lns

> test Semanage.lns get "UserParameter=custom.vfs.dev.read.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$4}'\n" = { "UserParameter" = "custom.vfs.dev.read.ops[*],cat /proc/diskstats | grep $1 | head -1 | awk '{print $$4}'" }

Quotes are OK in variables that do not begin with a quote

### Semanage.lns

> test Semanage.lns get "foo =\n" = { "foo" }

Support empty values

### Augeas Variables

### conf

> let conf = "

### Augeas Tests

### Semanage.lns

> test Semanage.lns get conf = { "module-store" = "direct" } { "module-store" = "source" } { } { "#comment" = "policy-version = 19" } { } { "expand-check" = "0" } { } { "usepasswd" = "False" } { "bzip-small" = "true" } { "bzip-blocksize" = "5" } { "ignoredirs" = "/root" } { } { "@group" = "sefcontext_compile" { "path" = "/usr/sbin/sefcontext_compile" } { "args" = "-r $@" } { } } { } { "config" = "test" } { } { "@group" = "verify module" { "test" = "value" } }

Parses /etc/selinux/semanage.conf

> let phony_conf = "# this is a comment mykey = myvalue # eol comment anotherkey = another value "

> test Semanage.lns get phony_conf = { "#comment" = "this is a comment" } { } { "mykey" = "myvalue" { "#comment" = "eol comment" } } { "anotherkey" = "another value" }

> let conf = "

Close