mofa 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +10 -3
- data/lib/mofa/provision_cmd.rb +5 -2
- data/lib/mofa/version.rb +1 -1
- data/rspec/mofa/hostfile_spec.rb +18 -0
- data/rspec/mofa/test_hostlist.json +7 -0
- metadata +4 -2
data/README.md
CHANGED
@@ -18,7 +18,8 @@ Before you can start using mofa please create a config file:
|
|
18
18
|
# A REST-Webservice that returns a list of hosts that are potentially
|
19
19
|
# manageable with this mofa.
|
20
20
|
#service_hostlist_url: http://a-real-server:9292/hosts
|
21
|
-
|
21
|
+
# You can also have a json-file somewhere. See the test-file in the rspec-folder
|
22
|
+
service_hostlist_url: file:///Users/<yourname>/.mofa/example_hostlist.json
|
22
23
|
service_hostlist_default_filter: "localhost"
|
23
24
|
service_hostlist_api_key: <a api key used to access the above service>
|
24
25
|
|
@@ -49,6 +50,12 @@ Before you can start using mofa please create a config file:
|
|
49
50
|
|
50
51
|
EOF
|
51
52
|
|
53
|
+
# local Development
|
52
54
|
|
53
|
-
|
54
|
-
|
55
|
+
$ git clone https://github.com/hybris/mofa.git
|
56
|
+
$ cd mofa
|
57
|
+
$ bundle install
|
58
|
+
$ cd ../somewhere_chef-env_some_cookbook
|
59
|
+
$ export BUNDLE_GEMFILE=../mofa/Gemfile
|
60
|
+
$ bundle exec
|
61
|
+
$ ../mofa/bin/mofa provision .
|
data/lib/mofa/provision_cmd.rb
CHANGED
@@ -114,8 +114,11 @@ class ProvisionCmd < MofaCmd
|
|
114
114
|
end
|
115
115
|
|
116
116
|
def create_data_bags(sftp, hostname, solo_dir)
|
117
|
+
puts "Remotely creating data_bags items..."
|
117
118
|
if cookbook.instance_of?(SourceCookbook) and File.directory?("#{cookbook.source_dir}/data_bags")
|
118
|
-
Dir.entries("#{cookbook.source_dir}/data_bags").
|
119
|
+
Dir.entries("#{cookbook.source_dir}/data_bags/").each do |data_bag|
|
120
|
+
next if data_bag =~ /^\.\.?$/
|
121
|
+
puts "Found data_bag #{data_bag}... "
|
119
122
|
Dir.entries("#{cookbook.source_dir}/data_bags/#{data_bag}").select { |f| f.match(/\.json$/) }.each do |data_bag_item|
|
120
123
|
puts "Uploading data_bag_item #{data_bag_item}... "
|
121
124
|
sftp.upload!("#{cookbook.source_dir}/data_bags/#{data_bag}/#{data_bag_item}", "#{solo_dir}/data_bags/#{data_bag}/#{data_bag_item}")
|
@@ -150,7 +153,7 @@ class ProvisionCmd < MofaCmd
|
|
150
153
|
|
151
154
|
# remotely create data_bag items
|
152
155
|
create_data_bags(sftp, hostname, solo_dir)
|
153
|
-
|
156
|
+
exit
|
154
157
|
puts "Uploading Package #{cookbook.pkg_name}... "
|
155
158
|
sftp.upload!("#{cookbook.pkg_dir}/#{cookbook.pkg_name}", "#{solo_dir}/#{cookbook.pkg_name}")
|
156
159
|
puts "OK."
|
data/lib/mofa/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'mofa/hostlist'
|
2
|
+
require 'mofa/config'
|
3
|
+
|
4
|
+
describe Hostlist do
|
5
|
+
before do
|
6
|
+
Mofa::Config.load
|
7
|
+
|
8
|
+
end
|
9
|
+
it "should initialize" do
|
10
|
+
hostlist = Hostlist.create("/.*/", "file://rspec/mofa/test_hostlist.json")
|
11
|
+
hostlist != nil
|
12
|
+
end
|
13
|
+
it "should retrieve" do
|
14
|
+
hostlist = Hostlist.create("/.*/", "file://rspec/mofa/test_hostlist.json")
|
15
|
+
puts hostlist.retrieve.count
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mofa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
@@ -235,6 +235,8 @@ files:
|
|
235
235
|
- lib/mofa/upload_cmd.rb
|
236
236
|
- lib/mofa/version.rb
|
237
237
|
- mofa.gemspec
|
238
|
+
- rspec/mofa/hostfile_spec.rb
|
239
|
+
- rspec/mofa/test_hostlist.json
|
238
240
|
homepage: https://github.com/pingworks/mofa
|
239
241
|
licenses: []
|
240
242
|
post_install_message:
|