Compare commits
No commits in common. "share_between_environments" and "main" have entirely different histories.
share_betw
...
main
|
@ -11,8 +11,7 @@ Rules-Requires-Root: no
|
||||||
|
|
||||||
Package: puppet-terminus-redis
|
Package: puppet-terminus-redis
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: ${misc:Depends}, puppet-master | puppet-master-passenger | puppetserver, redis, ruby-redis
|
Depends: ${misc:Depends}, puppet-master | puppet-master-passenger, redis, ruby-redis
|
||||||
Build-Depends: ${misc:Build-Depends}, ruby-puppetlabs-spec-helper
|
|
||||||
Description: Cache and data store terminus for puppet servers
|
Description: Cache and data store terminus for puppet servers
|
||||||
This provides an integration for using redis as a data store for
|
This provides an integration for using redis as a data store for
|
||||||
cached facts and/or storeconfigs from a puppet server.
|
cached facts and/or storeconfigs from a puppet server.
|
||||||
|
|
|
@ -31,9 +31,7 @@ class Puppet::Resource::Redis < Puppet::Indirector::REST
|
||||||
#
|
#
|
||||||
key = "catalog_#{host}_#{environment}"
|
key = "catalog_#{host}_#{environment}"
|
||||||
resources = []
|
resources = []
|
||||||
# With puppetdb, resources are picked up regardless of environment,
|
keys = redis.keys("catalog_*_#{environment}")
|
||||||
# and the user may choose to filter or not in the collector.
|
|
||||||
keys = redis.keys("catalog_*")
|
|
||||||
keys.each do |k|
|
keys.each do |k|
|
||||||
next if k == key
|
next if k == key
|
||||||
catalog = JSON.parse(redis.get(k))
|
catalog = JSON.parse(redis.get(k))
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
#!/usr/bin/env rspec
|
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
require 'puppet/util/feature'
|
|
||||||
require 'puppet/indirector/facts/redis'
|
|
||||||
require 'puppet/util/log'
|
|
||||||
|
|
||||||
describe Puppet::Node::Facts::Redis do
|
|
||||||
|
|
||||||
before :each do
|
|
||||||
Puppet::Node::Facts.indirection.stubs(:terminus).returns(subject)
|
|
||||||
create_environmentdir("test_environment")
|
|
||||||
end
|
|
||||||
|
|
||||||
describe '#save' do
|
|
||||||
let(:facts) { Puppet::Node::Facts.new('foo') }
|
|
||||||
let(:options) {{
|
|
||||||
:environment => "test_environment",
|
|
||||||
}}
|
|
||||||
let(:redis) { Puppet::Node::Facts::Redis.new }
|
|
||||||
|
|
||||||
it "should have a name" do
|
|
||||||
print(subject.name)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "should save a fact keyed with name and environment" do
|
|
||||||
facts.values['foo'] = 100
|
|
||||||
request = Puppet::Node::Facts.indirection.request(:save, facts.name, facts, options)
|
|
||||||
subject.save(request)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,7 +0,0 @@
|
||||||
#!/usr/bin/env rspec
|
|
||||||
require 'spec_helper'
|
|
||||||
|
|
||||||
# Despite the fact the class is Puppet::Resource::Redis, we use the
|
|
||||||
# path with 'indirector' to load it.
|
|
||||||
require 'puppet/indirector/resource/redis'
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
require 'puppetlabs_spec_helper/puppet_spec_helper'
|
|
||||||
require 'puppet/util'
|
|
||||||
|
|
||||||
RSpec.configure do |config|
|
|
||||||
|
|
||||||
def create_environmentdir(environment)
|
|
||||||
envdir = File.join(Puppet[:environmentpath], environment)
|
|
||||||
if not Dir.exists?(envdir)
|
|
||||||
Dir.mkdir(envdir)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# before :each do
|
|
||||||
# @logs = []
|
|
||||||
# Puppet::Util::Log.level = :info
|
|
||||||
# Puppet::Util::Log.newdestination(Puppet::Test::LogCollector.new(@logs))
|
|
||||||
# # dir = File.join(File.expand_path(File.dirname(__FILE__)), 'fixtures')
|
|
||||||
# # environments = Puppet::Environments::Cached.new(
|
|
||||||
# # Puppet::Environments::Directories.new(dir, [])
|
|
||||||
# # )
|
|
||||||
# # Puppet.push_context(
|
|
||||||
# # {
|
|
||||||
# # :environments => environments,
|
|
||||||
# # :current_environment => Puppet::Node::Environment.create(:testing, [])
|
|
||||||
# # }
|
|
||||||
# # )
|
|
||||||
# # print(Puppet.lookup(:environments))
|
|
||||||
# def test_logs
|
|
||||||
# @logs.map(&:message)
|
|
||||||
# end
|
|
||||||
# end
|
|
||||||
|
|
||||||
end
|
|
Loading…
Reference in New Issue