Merge branch 'master' of git://labs.riseup.net/shared-common

Conflicts:
	lib/puppet/parser/functions/gsub.rb
	lib/puppet/parser/functions/prefix_with.rb
	lib/puppet/parser/functions/slash_escape.rb
	lib/puppet/parser/functions/split.rb
	lib/puppet/parser/functions/substitute.rb
	manifests/classes/lsb_release.pp
	manifests/defines/concatenated_file.pp
	manifests/defines/config_file.pp
	manifests/defines/line.pp
	manifests/defines/module_dir.pp
	manifests/defines/module_file.pp
	manifests/defines/replace.pp
	manifests/init.pp
This commit is contained in:
Silvio Rhatto 2011-02-14 12:11:35 -02:00
commit 0b03f41b32
25 changed files with 406 additions and 275 deletions

View file

@ -0,0 +1,11 @@
Puppet::Parser::Functions::newfunction(
:array_del,
:type => :rvalue,
:doc => "Deletes items from an array
Example: array_del(['a','b'],'b') -> ['a']"
) do |args|
raise Puppet::ParseError, 'array_del() needs two arguments' if args.length != 2
(res=args[0].dup).to_a.delete(args[1])
res
end

View file

@ -1,13 +1,9 @@
#
# A thin wrapper around the ruby gsub function.
#
# gsub($string, $pattern, $replacement)
#
# will replace all occurrences of $pattern in $string with $replacement.
# $string can be either a single value or an array. In the latter case, each
# element of the array will be processed in turn.
#
module Puppet::Parser::Functions
# thin wrapper around the ruby gsub function
# gsub($string, $pattern, $replacement) will replace all occurrences of
# $pattern in $string with $replacement. $string can be either a singel
# value or an array. In the latter case, each element of the array will
# be processed in turn.
newfunction(:gsub, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args[0].collect do |val|

View file

@ -0,0 +1,13 @@
# get an uniq array of ipaddresses for a hostname
require 'resolv'
module Puppet::Parser::Functions
newfunction(:hostname, :type => :rvalue) do |args|
res = Array.new
Resolv::DNS.new.each_address(args[0]){ |addr|
res << addr
}
res.uniq
end
end

View file

@ -0,0 +1,10 @@
Puppet::Parser::Functions::newfunction(
:join,
:type => :rvalue,
:doc => "Joins the values of the array in arg1 with the string in arg2
Example: join(['a','b'],',') -> 'a,b'"
) do |args|
raise Puppet::ParseError, 'join() needs two arguments' if args.length != 2
args[0].to_a.join(args[1])
end

View file

@ -0,0 +1,29 @@
module Puppet::Parser::Functions
require 'erb'
newfunction(:multi_source_template, :type => :rvalue) do |args|
contents = nil
environment = compiler.environment
sources = args
sources.each do |file|
Puppet.debug("Looking for #{file} in #{environment}")
if filename = Puppet::Parser::Files.find_template(file, environment.to_s)
wrapper = Puppet::Parser::TemplateWrapper.new(self)
wrapper.file = file
begin
contents = wrapper.result
rescue => detail
raise Puppet::ParseError, "Failed to parse template %s: %s" % [file, detail]
end
break
end
end
raise Puppet::ParseError, "multi_source_template: No match found for files: #{sources.join(', ')}" if contents == nil
contents
end
end

View file

@ -1,15 +1,5 @@
# Prefixes arguments 2..n with first argument.
#
# prefix_with(string prefix, string[] arguments) : string[]
#
# Example:
#
# prefix_with("php-", [ "blah", "foo" ])
#
# will result in this array:
#
# [ "php-blah", "php-foo" ]
#
# prefix arguments 2..n with first argument
module Puppet::Parser::Functions
newfunction(:prefix_with, :type => :rvalue) do |args|
prefix = args.shift

View file

@ -0,0 +1,7 @@
# escape slashes in a String
module Puppet::Parser::Functions
newfunction(:slash_escape, :type => :rvalue) do |args|
args[0].gsub(/\//, '\\/')
end
end

View file

@ -0,0 +1,6 @@
module Puppet::Parser::Functions
newfunction(:strlength, :type => :rvalue) do |args|
args[0].to_s.length
end
end

View file

@ -0,0 +1,20 @@
# subsititute($string, $regex, $replacement) : $string
# subsititute($string[], $regex, $replacement) : $string[]
#
# Replace all ocurrences of $regex in $string by $replacement.
# $regex is interpreted as Ruby regular expression.
#
# For long-term portability it is recommended to refrain from using Ruby's
# extended RE features.
module Puppet::Parser::Functions
newfunction(:substitute, :type => :rvalue) do |args|
if args[0].is_a?(Array)
args[0].collect do |val|
val.gsub(/#{args[1]}/, args[2])
end
else
args[0].gsub(/#{args[1]}/, args[2])
end
end
end

View file

@ -0,0 +1,10 @@
Puppet::Parser::Functions::newfunction(
:uniq_flatten,
:type => :rvalue,
:doc => "Flattens an array and make it uniq
Example: uniq_flatten([['a','b'],'a']) -> ['a','b']"
) do |args|
raise Puppet::ParseError, 'uniq_flatten() needs one arguments' if args.length != 1
args[0].to_a.flatten.collect(&:to_s).uniq
end

View file

@ -1,49 +0,0 @@
# common/manifests/classes/lsb_release.pp -- request the installation of
# lsb_release to get to lsbdistcodename, which is used throughout the manifests
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Changelog:
# 2007-08-26: micah <micah@riseup.net> reported, that lsb_release can report
# nonsensical values for lsbdistcodename; assert_lsbdistcodename now
# recognises "n/a" and acts accordingly
# This lightweight class only asserts that $lsbdistcodename is set.
# If the assertion fails, an error is printed on the server
#
# To fail individual resources on a missing lsbdistcodename, require
# Exec[assert_lsbdistcodename] on the specific resource
#
# This is just one example of how you could avoid evaluation of parts of the
# manifest, before a bootstrapping class has enabled all the necessary goodies.
class assert_lsbdistcodename {
case $lsbdistcodename {
'': {
err("Please install lsb_release or set facter_lsbdistcodename in the environment of $fqdn")
exec { "false # assert_lsbdistcodename": alias => assert_lsbdistcodename, loglevel => err }
}
'n/a': {
case $operatingsystem {
"Debian": {
err("lsb_release was unable to report your distcodename; This seems to indicate a broken apt/sources.list on $fqdn")
}
default: {
err("lsb_release was unable to report your distcodename; please set facter_lsbdistcodename in the environment of $fqdn")
}
}
exec { "/bin/false # assert_lsbdistcodename": alias => assert_lsbdistcodename, loglevel => err }
}
default: {
exec { "/bin/true # assert_lsbdistcodename": alias => assert_lsbdistcodename, loglevel => debug }
exec { "/bin/true # require_lsbdistcodename": alias => require_lsbdistcodename, loglevel => debug }
}
}
}
# To fail the complete compilation on a missing $lsbdistcodename, include this class
class require_lsbdistcodename inherits assert_lsbdistcodename {
exec { "false # require_lsbdistcodename": require => Exec[require_lsbdistcodename], loglevel => err }
}

View file

@ -24,94 +24,102 @@ module_dir { "common/cf": }
#
# Depend on File[$name] to change if and only if its contents change. Notify
# Exec["concat_${name}"] if you want to force an update.
#
#
# Usage:
# concatenated_file { "/etc/some.conf":
# dir => "/etc/some.conf.d",
# dir => "/etc/some.conf.d",
# }
define concatenated_file (
# where the snippets are located
$dir = '',
# a file with content to prepend
$header = '',
# a file with content to append
$footer = '',
# default permissions for the target file
$mode = 0644, $owner = root, $group = 0
)
$ensure = 'present',
# where the snippets are located
$dir = '',
# a file with content to prepend
$header = '',
# a file with content to append
$footer = '',
# default permissions for the target file
$mode = 0644, $owner = root, $group = 0
)
{
include common::moduledir::common::cf
$dir_real = $dir ? { '' => "${name}.d", default => $dir }
$dir_real = $dir ? { '' => "${name}.d", default => $dir }
$tmp_file_name = regsubst($dir_real, '/', '_', 'G')
$tmp_file = "${module_dir_path}/${tmp_file_name}"
$tmp_file_name = regsubst($dir_real, '/', '_', 'G')
$tmp_file = "${common::moduledir::module_dir_path}/${tmp_file_name}"
if defined(File[$dir_real]) {
debug("${dir_real} already defined")
} else {
file {
$dir_real:
source => "puppet://$server/modules/common/empty",
checksum => mtime,
ignore => '.ignore',
recurse => true, purge => true, force => true,
mode => $mode, owner => $owner, group => $group,
notify => Exec["concat_${name}"];
}
}
if defined(File[$dir_real]) {
debug("${dir_real} already defined")
} else {
file {
$dir_real:
ensure => $ensure ? {
'present' => directory,
default => $ensure
},
source => "puppet:///modules/common/empty",
checksum => mtime,
ignore => '.ignore',
recurse => true, purge => true, force => true,
mode => $mode, owner => $owner, group => $group,
notify => Exec["concat_${name}"];
}
}
file {
$tmp_file:
ensure => present, checksum => md5,
mode => $mode, owner => $owner, group => $group;
# decouple the actual file from the generation process by using a
# temporary file and puppet's source mechanism. This ensures that events
# for notify/subscribe will only be generated when there is an actual
# change.
$name:
ensure => present, checksum => md5,
source => $tmp_file,
mode => $mode, owner => $owner, group => $group,
require => File[$tmp_file];
}
file {
$tmp_file:
ensure => $ensure, checksum => md5,
mode => $mode, owner => $owner, group => $group;
# decouple the actual file from the generation process by using a
# temporary file and puppet's source mechanism. This ensures that events
# for notify/subscribe will only be generated when there is an actual
# change.
$name:
ensure => $ensure, checksum => md5,
source => $tmp_file,
mode => $mode, owner => $owner, group => $group,
require => File[$tmp_file];
}
# if there is a header or footer file, add it
$additional_cmd = $header ? {
'' => $footer ? {
'' => '',
default => "| cat - '${footer}' "
},
default => $footer ? {
'' => "| cat '${header}' - ",
default => "| cat '${header}' - '${footer}' "
}
}
# use >| to force clobbering the target file
exec { "concat_${name}":
command => "/usr/bin/find ${dir_real} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${additional_cmd} >| ${tmp_file}",
subscribe => [ File[$dir_real] ],
before => File[$tmp_file],
alias => [ "concat_${dir_real}"],
loglevel => info
}
if $ensure == 'present' {
# if there is a header or footer file, add it
$additional_cmd = $header ? {
'' => $footer ? {
'' => '',
default => "| cat - '${footer}' "
},
default => $footer ? {
'' => "| cat '${header}' - ",
default => "| cat '${header}' - '${footer}' "
}
}
# use >| to force clobbering the target file
exec { "concat_${name}":
command => "/usr/bin/find ${dir_real} -maxdepth 1 -type f ! -name '*puppettmp' -print0 | sort -z | xargs -0 cat ${additional_cmd} >| ${tmp_file}",
subscribe => [ File[$dir_real] ],
before => File[$tmp_file],
alias => [ "concat_${dir_real}"],
loglevel => info
}
}
}
# Add a snippet called $name to the concatenated_file at $dir.
# The file can be referenced as File["cf_part_${name}"]
define concatenated_file_part (
$dir, $content = '', $ensure = present,
$mode = 0644, $owner = root, $group = 0
)
$dir, $content = '', $ensure = present,
$mode = 0644, $owner = root, $group = 0
)
{
file { "${dir}/${name}":
ensure => $ensure, content => $content,
mode => $mode, owner => $owner, group => $group,
alias => "cf_part_${name}",
notify => Exec["concat_${dir}"],
}
file { "${dir}/${name}":
ensure => $ensure, content => $content,
mode => $mode, owner => $owner, group => $group,
alias => "cf_part_${name}",
notify => Exec["concat_${dir}"],
}
}

View file

@ -5,11 +5,11 @@
# A simple wrapper to give all configuration files common defaults.
#
# Usage:
# config_file { filename:
# content => "....\n",
# }
# config_file { filename:
# content => "....\n",
# }
#
# Examples:
# Examples:
#
# To create the file /etc/vservers/${vs_name}/context with specific
# content:
@ -24,35 +24,33 @@
# To create the file /etc/apache2/sites-available/munin-stats with the
# content pulled from a template:
#
# config_file {
# "/etc/apache2/sites-available/munin-stats":
# content => template("apache/munin-stats"),
# require => Package["apache2"],
# notify => Exec["reload-apache2"];
# }
define config_file (
$content = '',
$source = '',
$ensure = 'present')
{
file { $name:
ensure => $ensure,
# default permissions for config files
mode => 0644, owner => root, group => 0,
# really detect changes to this file
checksum => md5,
}
# config_file { "/etc/apache2/sites-available/munin-stats":
# content => template("apache/munin-stats"),
# require => Package["apache2"],
# notify => Exec["reload-apache2"]
# }
case $source {
'': { }
default: { File[$name] { source => $source } }
}
define config_file ($content = '', $source = '', $ensure = 'present') {
file { $name:
ensure => $ensure,
# keep old versions on the server
backup => puppet,
# default permissions for config files
mode => 0644, owner => root, group => 0,
# really detect changes to this file
checksum => md5,
}
case $source {
'': { }
default: { File[$name] { source => $source } }
}
case $content {
'': { }
default: { File[$name] { content => $content } }
}
case $content {
'': { }
default: { File[$name] { content => $content } }
}
}

View file

@ -14,11 +14,10 @@
# is a more stable solution with less maintenance headaches afterwards.
#
# Usage:
# line {
# description:
# file => "filename",
# line => "content",
# ensure => {absent,*present*}
# line { description:
# file => "filename",
# line => "content",
# ensure => {absent,*present*}
# }
#
# Example:
@ -39,27 +38,16 @@
# http://reductivelabs.com/trac/puppet/wiki/Recipes/SimpleText
define line($file, $line, $ensure = 'present') {
case $ensure {
default: { err ( "unknown ensure value ${ensure}" ) }
default : { err ( "unknown ensure value '${ensure}'" ) }
present: {
exec { "/bin/echo '${line}' >> '${file}'":
unless => "/bin/grep -qFx '${line}' '${file}'",
require => File["${file}"],
exec { "echo '${line}' >> '${file}'":
unless => "grep -qFx '${line}' '${file}'"
}
}
absent: {
exec { "/usr/bin/perl -ni -e 'print unless /^\\Q${line}\\E\$/' '${file}'":
onlyif => "/bin/grep -qFx '${line}' '${file}'",
}
}
uncomment: {
exec { "/bin/sed -i -e'/${line}/s/^#\+//' '${file}'":
onlyif => "/bin/grep '${line}' '${file}' | /bin/grep '^#' | /usr/bin/wc -l"
}
}
comment: {
exec { "/bin/sed -i -e'/${line}/s/^\(.\+\)$/#\1/' '${file}'":
onlyif => "/usr/bin/test `/bin/grep '${line}' '${file}' | /bin/grep -v '^#' | /usr/bin/wc -l` -ne 0",
require => File["${file}"],
$subst_line = regsubst($line,'(/|\.)','\\\1','G')
exec { "sed -i '/${subst_line}/d' '${file}'":
onlyif => "grep -qFx '${line}' '${file}'"
}
}
}

12
manifests/defines/link.pp Normal file
View file

@ -0,0 +1,12 @@
# common/manifests/defines/link.pp -- create a link
#
# Copyleft (C) 2009 immerdaadmin <admin@immerda.ch>
# See LICENSE for the full license granted to you.
# Usage:
# link { "/usr/bin/convert": target => "/usr/local/bin/convert" }
# e.g. equivalent to bash# ln -s /usr/bin/convert /usr/local/bin/convert
define link($target = absent) {
file{$name: ensure => $target; }
}

View file

@ -1,42 +1,41 @@
# common/manifests/defines/module_dir.pp -- create a default directory
# common/manifests/defines/modules_dir.pp -- create a default directory
# for storing module specific information
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# A module_dir is a storage place for all the stuff a module might want to
# store. According to the FHS, this should go to /var/lib. Since this is a part
# of puppet, the full path is /var/lib/puppet/modules/${name}. Every module
# should # prefix its module_dirs with its name.
#
# By default, the module_dir is loaded from "puppet:///${name}/module_dir". If
# that doesn't exist an empty directory is taken as source. The directory is
# purged so that modules do not have to worry about removing cruft.
#
# Usage:
# module_dir { ["common", "common/dir1", "common/dir2" ]: }
# include common::moduledir
# module_dir { ["common", "common/dir1", "common/dir2" ]: }
#
# You may refer to a file in module_dir by using :
# file { "${common::moduledir::module_dir_path}/somedir/somefile": }
define module_dir (
$mode = 0644,
$owner = root,
$group = 0
)
$mode = 0644, $owner = root, $group = 0
)
{
$dir = "${module_dir_path}/${name}"
if defined(File[$dir]) {
debug("${dir} already defined")
} else {
file {
$dir:
source => [ "puppet://$server/modules/${name}/module_dir", "puppet://$server/modules/common/empty"],
checksum => mtime,
# ignore the placeholder
ignore => '\.ignore',
recurse => true, purge => true, force => true,
mode => $mode, owner => $owner, group => $group;
}
}
include common::moduledir
$dir = "${common::moduledir::module_dir_path}/${name}"
if defined(File[$dir]) {
debug("${dir} already defined")
} else {
file {
$dir:
source => [ "puppet:///modules/${name}/modules_dir", "puppet:///modules/common/empty"],
checksum => mtime,
# ignore the placeholder
ignore => '.ignore',
recurse => true, purge => true, force => true,
mode => $mode, owner => $owner, group => $group;
}
}
}
# Use this variable to reference the base path. Thus you are safe from any
# changes.
$module_dir_path = '/var/lib/puppet/modules'
# alias for compatibility
define modules_dir (
$mode = 0644, $owner = root, $group = 0
)
{
module_dir { $name: mode => $mode, owner => $owner, group => $group }
}

View file

@ -1,24 +1,45 @@
# common/manifests/defines/module_file.pp -- use an already defined module_dir
# to store module specific files
# common/manifests/defines/modules_file.pp -- use a modules_dir to store module
# specific files
#
# Copyright (C) 2007 David Schmitt <david@schmitt.edv-bus.at>
# See LICENSE for the full license granted to you.
# Put a file into module-local storage.
#
# Usage:
# module_file {
# "module/file":
# source => "puppet://..",
# modules_file { "module/file":
# source => "puppet:///...",
# mode => 644, # default
# owner => root, # default
# group => 0, # default
# }
define module_file (
$source,
$mode = 0644, $owner = root, $group = 0
)
$source,
$ensure = present,
$alias = undef,
$mode = 0644, $owner = root, $group = 0
)
{
file {
"${module_dir_path}/${name}":
source => $source,
mode => $mode, owner => $owner, group => $group;
}
include common::moduledir
file {
"${common::moduledir::module_dir_path}/${name}":
source => $source,
ensure => $ensure,
alias => $alias,
mode => $mode, owner => $owner, group => $group;
}
}
# alias for compatibility
define modules_file (
$source,
$ensure = present,
$alias = undef,
$mode = 0644, $owner = root, $group = 0
)
{
module_file { $name:
source => $source,
ensure => $ensure,
alias => $alias,
mode => $mode, owner => $owner, group => $group
}
}

View file

@ -14,7 +14,7 @@
#
# Usage:
#
# replace { description:
# replace { description:
# file => "filename",
# pattern => "regexp",
# replacement => "replacement"
@ -23,19 +23,18 @@
# To replace the current port in /etc/munin/munin-node.conf
# with a new port, but only disturbing the file when needed:
#
# replace {
# set_munin_node_port:
# file => "/etc/munin/munin-node.conf",
# pattern => "^port (?!$port)[0-9]*",
# replacement => "port $port"
# }
define replace($file, $pattern, $replacement) {
$pattern_no_slashes = regsubst($pattern, '/', '\\/', 'G', 'U')
$replacement_no_slashes = regsubst($replacement, '/', '\\/', 'G', 'U')
# replace { set_munin_node_port:
# file => "/etc/munin/munin-node.conf",
# pattern => "^port (?!$port)[0-9]*",
# replacement => "port $port"
# }
exec { "replace_${pattern}_${file}":
command => "/usr/bin/perl -pi -e 's/${pattern_no_slashes}/${replacement_no_slashes}/' '${file}'",
onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /${pattern_no_slashes}/ && ! /\\Q${replacement_no_slashes}\\E/; END { exit \$ret; }' '${file}'",
alias => "exec_$name",
}
define replace($file, $pattern, $replacement) {
$pattern_no_slashes = slash_escape($pattern)
$replacement_no_slashes = slash_escape($replacement)
exec { "replace_${pattern}_${file}":
command => "/usr/bin/perl -pi -e 's/${pattern_no_slashes}/${replacement_no_slashes}/' '${file}'",
onlyif => "/usr/bin/perl -ne 'BEGIN { \$ret = 1; } \$ret = 0 if /${pattern_no_slashes}/ && ! /\\Q${replacement_no_slashes}\\E/; END { exit \$ret; }' '${file}'",
alias => "exec_$name",
}
}

View file

@ -3,23 +3,3 @@
# See LICENSE for the full license granted to you.
import "defines/*.pp"
import "classes/*.pp"
module_dir { [ 'common' ]: }
file {
# Module programmers can use /var/lib/puppet/modules/$modulename to save
# module-local data, e.g. for constructing config files. See module_dir
# for details
"/var/lib/puppet/modules":
ensure => directory,
source => "puppet://$server/modules/common/modules",
ignore => ".ignore",
recurse => true, purge => true, force => true,
mode => 0755, owner => root, group => 0;
}
# common packages
class pkg::openssl { package { openssl: ensure => installed } }
class pkg::rsync { package { rsync: ensure => installed } }

15
manifests/moduledir.pp Normal file
View file

@ -0,0 +1,15 @@
class common::moduledir {
# Use this variable to reference the base path. Thus you are safe from any
# changes.
$module_dir_path = '/var/lib/puppet/modules'
# Module programmers can use /var/lib/puppet/modules/$modulename to save
# module-local data, e.g. for constructing config files
file{$module_dir_path:
ensure => directory,
source => "puppet:///modules/common/modules/",
ignore => '.ignore',
recurse => true, purge => true, force => true,
mode => 0755, owner => root, group => 0;
}
}

View file

@ -0,0 +1,3 @@
class common::moduledir::common{
module_dir{'common': }
}

View file

@ -0,0 +1,4 @@
class common::moduledir::common::cf {
include ::common::moduledir::common
module_dir{'common/cf': }
}

6
spec/spec.opts Normal file
View file

@ -0,0 +1,6 @@
--format
s
--colour
--loadby
mtime
--backtrace

16
spec/spec_helper.rb Normal file
View file

@ -0,0 +1,16 @@
require 'pathname'
dir = Pathname.new(__FILE__).parent
$LOAD_PATH.unshift(dir, dir + 'lib', dir + '../lib')
require 'puppet'
gem 'rspec', '>= 1.2.9'
require 'spec/autorun'
Dir[File.join(File.dirname(__FILE__), 'support', '*.rb')].each do |support_file|
require support_file
end
# We need this because the RAL uses 'should' as a method. This
# allows us the same behaviour but with a different method name.
class Object
alias :must :should
end

View file

@ -0,0 +1,39 @@
#! /usr/bin/env ruby
require File.dirname(__FILE__) + '/../../../spec_helper'
describe "the array_del function" do
before :each do
@scope = Puppet::Parser::Scope.new
end
it "should exist" do
Puppet::Parser::Functions.function("array_del").should == "function_array_del"
end
it "should raise a ParseError if there is less than 2 arguments" do
lambda { @scope.function_array_del(["foo"]) }.should( raise_error(Puppet::ParseError))
end
it "should raise a ParseError if there is more than 2 arguments" do
lambda { @scope.function_array_del(["foo", "bar", "gazonk"]) }.should( raise_error(Puppet::ParseError))
end
it "should remove an item if it's present" do
result = @scope.function_array_del(['a','b'],'b')
result.should(eql(['a']))
end
it "should do nothing if an item is not present" do
result = @scope.function_array_del(['a','b'],'c')
result.should(eql(['a','b']))
end
it "should leave the argument untouched" do
a = ['a','b']
result = @scope.function_array_del(a,'b')
a.should(eql(['a','b']))
end
end