2015-07-22 5 views
0

У меня есть ниже проявляется с file_line ресурсомRSpec-марионетка не поддерживает file_line ресурса

class login { 

    if $::operatingsystemmajrelease < 7 { 

    file {'/etc/loginfile': 
     ensure => present, 
    } 

    file_line { 'testfile': 
     path => '/etc/loginfile', 
     line => 'abc 022', 
     match => '^abc.*$', 
    } 
    } 
} 

Ниже RSpec файл

require 'spec_helper' 

describe 'login' do 

    it { should contain_class('login')} 

    let(:facts) {{:operatingsystemmajrelease => 6}} 

    if (6 < 7) 
    it { should contain_file('/etc/loginfile').with_ensure('present')} 

    it { should contain_file_line('testfile').with(
     :path => '/etc/loginfile', 
     :line => 'abc 022', 
     :match => '^abc.*$' 
    )} 
    end 
end 

Когда я запускаю грабли спекуляции команды получение ниже ошибок

login 
    Failure/Error: it { should contain_class('login')} 
    Puppet::Error: 
     Puppet::Parser::AST::Resource failed with error ArgumentError: Invalid resource type file_line at /etc/puppetlabs/modulename/login/spec/fixtures/modules/login_defs/manifests/init.pp:17 on node 
    # ./spec/classes/login_spec.rb:5 

rspec не поддерживает файловую систему resporce?

Becase, если удалить «file_line» ресурс и запустить файл rsepc его рабочим

ответ

0

file_line в puppetlabs-STDLIB, так что вам нужно включить, что в вашем испытательном стенде.

Самый простой способ в .fixtures.yml:

fixtures: 
    repositories: 
    stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib"