Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Commit

Permalink
using node[:backups][:region] config, chef solo "cannot configure" wa…
Browse files Browse the repository at this point in the history
…rning same as chef server
  • Loading branch information
wormzer committed Aug 30, 2013
1 parent e876f9c commit 55d45f9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 9 deletions.
1 change: 1 addition & 0 deletions chef/cookbooks/mongodb/definitions/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@
action [:auto_attach]
snapshots MongoDB.find_snapshots(aws["aws_access_key_id"],
aws["aws_secret_access_key"],
node[:backups][:region],
node[:backups][:mongo_volumes],
node[:mongodb][:cluster_name])
end
Expand Down
4 changes: 2 additions & 2 deletions chef/cookbooks/mongodb/libraries/ec2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Chef::ResourceDefinitionList::MongoDB
# nil. The returned snapshots array will be parallel to the volumes array,
# i.e the latest snapshot for the Nth volume in the array will be the Nth
# snapshot in the result.
def self.find_snapshots(key, secret_key, volumes, clustername)
def self.find_snapshots(key, secret_key, region, volumes, clustername)
require 'aws-sdk'

if volumes.size == 0
Expand All @@ -18,7 +18,7 @@ def self.find_snapshots(key, secret_key, volumes, clustername)
# Compute the latest snapshots.
ec2 = AWS::EC2.new(
:access_key_id => key,
:secret_access_key => secret_key)
:secret_access_key => secret_key).regions[region]

# This is an array of arrays. snapshots[i] will have the sorted list of
# snapshots for volumes[i]. The snapshots are sorted by description which
Expand Down
8 changes: 2 additions & 6 deletions chef/cookbooks/mongodb/libraries/mongodb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,8 @@ def self.configure_replicaset(node, name, members)
require 'mongo'

if members.length == 0
if Chef::Config[:solo]
abort("Cannot configure replicaset '#{name}', no member nodes found")
else
Chef::Log.warn("Cannot configure replicaset '#{name}', no member nodes found")
return
end
Chef::Log.warn("Cannot configure replicaset '#{name}', no member nodes found")
return
end

begin
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ else
string="Mongo RAID Snapshot $(date +%F:%T)"
fi

/usr/local/bin/mongo-ec2-raid-snapshot --quiet --region us-east-1 --description "$string" <%= node['backups']['mongo_volumes'].join(" ") %>
/usr/local/bin/mongo-ec2-raid-snapshot --quiet --region <%= node['backups']['region'] %> --description "$string" <%= node['backups']['mongo_volumes'].join(" ") %>

0 comments on commit 55d45f9

Please sign in to comment.