No side effects, no surprises.

Sample

Here is a sample of what the V language looks like.

sample.v
[Sample]
type = glob
path = /var/vermont/sandbox
permissions = 640 # owners R/W, group R/O, public none

In this sample, the statements define an object called Sample that verifies that all files in the /var/vermont/sandbox directory have filesystem permissions of 640 (where the owner has both read and write access, the group has read-only access, and the general public has no access).

Note that this is not just a code snippet, it is the complete definition of an object, and is fully executable by the interpreter.

Syntax terminology

Examining the sample we can introduce some terminology for talking about the language's parts.

  • [Sample] is a resource object name
  • type is a keyword
  • = is the keyword assignment operator
  • glob is a value
  • owners R/W, group R/O, public none is a comment

Advanced sample

A more advanced sample, for validating a software package configuration, might look like this:

advanced-sample.v
#-----------------------------------------------
# package installation and service configuration
#-----------------------------------------------
[apache_setup:apache_package]
type = software
name = apache
version = 2.2.23-1
unit_file_state = enabled
load_state = loaded
active_state = active
sub_state = running

[apache_setup:php_package]
type = software
name = php
version = 5.4.14

[apache_setup:imagick_package]
type = software
name = imagick
version = 6.7.5-6

#-----------------------------------------------
# configuration
#-----------------------------------------------
[apache_setup:apache_config]
type = configuration
path = /etc/httpd/conf/httpd.conf
keyword_value = User => apache | Group => apache
# restrict the HTTP response header to showing 'Server: Apache' without any version info
keyword_value += ServerTokens => Prod

[apache_setup:php_config]
type = configuration
path = /etc/php.ini
# turn off the HTTP response header 'X-Powered-By: PHP/5.2.9'
keyword_value = expose_php => off
keyword_value += short_open_tag => on
keyword_value += magic_quotes_gpc => off
keyword_value += error_reporting => E_ALL
keyword_value += date.timezone => America/Los_Angeles
# These settings should be used when in production mode
keyword_value += display_errors => off
keyword_value += display_startup_errors => off
keyword_value += log_errors => on
keyword_value += error_log => /var/log/php.log

[apache_setup:etc_config_d_php_conf]
type = configuration
path = /etc/httpd/conf.d/php.conf
keyword_value = AddHandler => php5-script .php .inc

[apache_setup:apc_rfc1867]
type = configuration
path = /etc/php.d/apc.ini
keyword_value = apc.rfc1867 => on

Syntax terminology

From the second sample we can see some additional language parts.

  • [apache_setup:imagick_package] is a "scoped object" name
  • apache_setup is the scoping name
  • imagick_package is the base name
  • += is the keyword concatenation operator
  • => is the assertion operator