diff options
| author | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-12 12:02:21 -0700 |
|---|---|---|
| committer | Daniel Pittman <daniel@puppetlabs.com> | 2011-05-12 12:02:21 -0700 |
| commit | 058cc39227112cefc637d38fd67d471945b2d4aa (patch) | |
| tree | 9bb4a6f963f973b439e0dbe5c348e9497aef06fe | |
| parent | f80afbe72b848fe4ed81d8116d4eeb494aa6f61e (diff) | |
| parent | 1f438da968e1583d900903407c2e5b17648fa937 (diff) | |
| download | puppet-058cc39227112cefc637d38fd67d471945b2d4aa.tar.gz puppet-058cc39227112cefc637d38fd67d471945b2d4aa.tar.xz puppet-058cc39227112cefc637d38fd67d471945b2d4aa.zip | |
Merge branch '2.6.x' into 2.7.next
Fix conflicts in the changelog, and one agent spec in favour of the 2.7.next
version of the code.
Paired-With: Jacob Helwig <jacob@puppetlabs.com>
| -rw-r--r-- | CHANGELOG | 11 | ||||
| -rw-r--r-- | ext/vim/README | 3 | ||||
| -rw-r--r-- | ext/vim/ftplugin/puppet.vim | 94 | ||||
| -rw-r--r-- | ext/vim/indent/puppet.vim | 76 | ||||
| -rw-r--r-- | lib/puppet.rb | 3 | ||||
| -rw-r--r-- | lib/puppet/application/agent.rb | 4 | ||||
| -rwxr-xr-x | lib/puppet/provider/mount/parsed.rb | 2 |
7 files changed, 183 insertions, 10 deletions
@@ -1,5 +1,5 @@ 2.7.0rc2 -=== +======== 61edff9 (#7353) Remove :for_humans format entirely. d2b5ec6 Adding test for ticket 7139 6f2a129 add clean-up step to test for ticket_5477 to prevent site.pp from leaking to other tests @@ -162,7 +162,7 @@ fc18591 Adding pkgutil support. 2.7.0rc1 -==== +======== 5915814 Revert "(#6928) Removed --ignoreimport" 24a277c (#6928) Removed --ignoreimport fc36e8d (#6928) Remove --parseonly @@ -667,8 +667,11 @@ d532e6d Fixing #3185 Rakefile is loading puppet.rb twice 3457b87 Added time module to tagmail report -2.6.8rc1 -==== +2.6.8 +===== +c1edcb2 add test for ticket 7101 +db26326 Move tests from puppet-acceptance repo +bee1ef7 Updated CHANGELOG for 2.6.8rc1 8b7444d (#2331) Remove darwinports pkg provider, replace with rewritten macports provider 65c4e14 Fixed #7082 - Added system support for groups b7f4ff7 (#7018) Give more context on the service type's assumptions. Wording tweaks. diff --git a/ext/vim/README b/ext/vim/README index 776bb1eb2..7fd2934fb 100644 --- a/ext/vim/README +++ b/ext/vim/README @@ -1,2 +1,3 @@ To install these files, copy them into ~/.vim, or the relevant -system-wide location. +system-wide location. To use the ftplugin and indenting, you may need +to enable them with "filetype plugin indent on" in your vimrc. diff --git a/ext/vim/ftplugin/puppet.vim b/ext/vim/ftplugin/puppet.vim new file mode 100644 index 000000000..b6491554b --- /dev/null +++ b/ext/vim/ftplugin/puppet.vim @@ -0,0 +1,94 @@ +" Vim filetype plugin +" Language: Puppet +" Maintainer: Todd Zullinger <tmz@pobox.com> +" Last Change: 2009 Aug 19 +" vim: set sw=4 sts=4: + +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin = 1 + +if !exists("no_plugin_maps") && !exists("no_puppet_maps") + if !hasmapto("<Plug>AlignRange") + map <buffer> <LocalLeader>= <Plug>AlignRange + endif +endif + +noremap <buffer> <unique> <script> <Plug>AlignArrows :call <SID>AlignArrows()<CR> +noremap <buffer> <unique> <script> <Plug>AlignRange :call <SID>AlignRange()<CR> + +iabbrev => =><C-R>=<SID>AlignArrows('=>')<CR> +iabbrev +> +><C-R>=<SID>AlignArrows('+>')<CR> + +if exists('*s:AlignArrows') + finish +endif + +let s:arrow_re = '[=+]>' +let s:selector_re = '[=+]>\s*\$.*\s*?\s*{\s*$' + +function! s:AlignArrows(op) + let cursor_pos = getpos('.') + let lnum = line('.') + let line = getline(lnum) + if line !~ s:arrow_re + return + endif + let pos = stridx(line, a:op) + let start = lnum + let end = lnum + let pnum = lnum - 1 + while 1 + let pline = getline(pnum) + if pline !~ s:arrow_re || pline =~ s:selector_re + break + endif + let start = pnum + let pnum -= 1 + endwhile + let cnum = end + while 1 + let cline = getline(cnum) + if cline !~ s:arrow_re || + \ (indent(cnum) != indent(cnum+1) && getline(cnum+1) !~ '\s*}') + break + endif + let end = cnum + let cnum += 1 + endwhile + call s:AlignSection(start, end) + let cursor_pos[2] = stridx(getline('.'), a:op) + strlen(a:op) + 1 + call setpos('.', cursor_pos) + return '' +endfunction + +function! s:AlignRange() range + call s:AlignSection(a:firstline, a:lastline) +endfunction + +" AlignSection and AlignLine are from the vim wiki: +" http://vim.wikia.com/wiki/Regex-based_text_alignment +function! s:AlignSection(start, end) + let extra = 1 + let sep = s:arrow_re + let maxpos = 0 + let section = getline(a:start, a:end) + for line in section + let pos = match(line, ' *'.sep) + if maxpos < pos + let maxpos = pos + endif + endfor + call map(section, 's:AlignLine(v:val, sep, maxpos, extra)') + call setline(a:start, section) +endfunction + +function! s:AlignLine(line, sep, maxpos, extra) + let m = matchlist(a:line, '\(.\{-}\) \{-}\('.a:sep.'.*\)') + if empty(m) + return a:line + endif + let spaces = repeat(' ', a:maxpos - strlen(m[1]) + a:extra) + return m[1] . spaces . m[2] +endfunction diff --git a/ext/vim/indent/puppet.vim b/ext/vim/indent/puppet.vim new file mode 100644 index 000000000..689e06879 --- /dev/null +++ b/ext/vim/indent/puppet.vim @@ -0,0 +1,76 @@ +" Vim indent file +" Language: Puppet +" Maintainer: Todd Zullinger <tmz@pobox.com> +" Last Change: 2009 Aug 19 +" vim: set sw=4 sts=4: + +if exists("b:did_indent") + finish +endif +let b:did_indent = 1 + +setlocal autoindent smartindent +setlocal indentexpr=GetPuppetIndent() +setlocal indentkeys+=0],0) + +if exists("*GetPuppetIndent") + finish +endif + +" Check if a line is part of an include 'block', e.g.: +" include foo, +" bar, +" baz +function! s:PartOfInclude(lnum) + let lnum = a:lnum + while lnum + let lnum = lnum - 1 + let line = getline(lnum) + if line !~ ',$' + break + endif + if line =~ '^\s*include\s\+[^,]\+,$' + return 1 + endif + endwhile + return 0 +endfunction + +function! s:OpenBrace(lnum) + call cursor(a:lnum, 1) + return searchpair('{\|\[\|(', '', '}\|\]\|)', 'nbW') +endfunction + +function! GetPuppetIndent() + let pnum = prevnonblank(v:lnum - 1) + if pnum == 0 + return 0 + endif + + let line = getline(v:lnum) + let pline = getline(pnum) + let ind = indent(pnum) + + if pline =~ '^\s*#' + return ind + endif + + if pline =~ '\({\|\[\|(\|:\)$' + let ind += &sw + elseif pline =~ ';$' && pline !~ '[^:]\+:.*[=+]>.*' + let ind -= &sw + elseif pline =~ '^\s*include\s\+.*,$' + let ind += &sw + endif + + if pline !~ ',$' && s:PartOfInclude(pnum) + let ind -= &sw + endif + + " Match } }, }; ] ]: ) + if line =~ '^\s*\(}\(,\|;\)\?$\|]:\?$\|)\)' + let ind = indent(s:OpenBrace(v:lnum)) + endif + + return ind +endfunction diff --git a/lib/puppet.rb b/lib/puppet.rb index e20874b61..bcac94d45 100644 --- a/lib/puppet.rb +++ b/lib/puppet.rb @@ -59,8 +59,7 @@ module Puppet # configuration parameter access and stuff def self.[](param) - case param - when :debug + if param == :debug return Puppet::Util::Log.level == :debug else return @@settings[param] diff --git a/lib/puppet/application/agent.rb b/lib/puppet/application/agent.rb index fc8616817..19849c57a 100644 --- a/lib/puppet/application/agent.rb +++ b/lib/puppet/application/agent.rb @@ -378,8 +378,8 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License end def setup_listen - unless FileTest.exists?(Puppet[:authconfig]) - Puppet.err "Will not start without authorization file #{Puppet[:authconfig]}" + unless FileTest.exists?(Puppet[:rest_authconfig]) + Puppet.err "Will not start without authorization file #{Puppet[:rest_authconfig]}" exit(14) end diff --git a/lib/puppet/provider/mount/parsed.rb b/lib/puppet/provider/mount/parsed.rb index 11c5e21a9..7c3f41bbd 100755 --- a/lib/puppet/provider/mount/parsed.rb +++ b/lib/puppet/provider/mount/parsed.rb @@ -18,7 +18,7 @@ Puppet::Type.type(:mount).provide( commands :mountcmd => "mount", :umount => "umount" - case Facter["operatingsystem"] + case Facter.value(:operatingsystem) when "Solaris" @fields = [:device, :blockdevice, :name, :fstype, :pass, :atboot, :options] else |
