noc 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/noc +26 -3
- data/lib/noc.rb +0 -1
- data/lib/noc/version.rb +1 -1
- metadata +1 -1
data/bin/noc
CHANGED
@@ -73,8 +73,10 @@ command :init do |c|
|
|
73
73
|
if not File.exists?(template) then
|
74
74
|
raise "Template not found: #{template}"
|
75
75
|
end
|
76
|
-
|
77
|
-
|
76
|
+
File.open( VAGRANTFILE, 'w' ) do |f|
|
77
|
+
f.write( Erubis::Eruby.new(File.new(template).read).result({:clusterfile => global_options[:clusterfile],
|
78
|
+
:cluster => $cluster}))
|
79
|
+
end
|
78
80
|
puts "init command ran"
|
79
81
|
end
|
80
82
|
end
|
@@ -82,12 +84,18 @@ end
|
|
82
84
|
desc 'Upload cookbook, role, databag'
|
83
85
|
arg_name 'COMMAND [options]'
|
84
86
|
command :upload do |c|
|
87
|
+
c.desc 'force'
|
88
|
+
c.switch :f
|
89
|
+
|
85
90
|
c.action do |global_options,options,args|
|
86
91
|
case
|
87
92
|
when args[0] == 'books'
|
88
93
|
system("knife cookbook upload --all")
|
89
94
|
when args[0] == "book"
|
90
|
-
|
95
|
+
args.shift
|
96
|
+
args.each do |a|
|
97
|
+
system("knife cookbook upload #{a}")
|
98
|
+
end
|
91
99
|
|
92
100
|
when args[0] == "roles"
|
93
101
|
Dir.glob("roles/*.rb").each do |f|
|
@@ -102,6 +110,21 @@ command :upload do |c|
|
|
102
110
|
end
|
103
111
|
when args[0] == "env"
|
104
112
|
system("knife environment from file environments/#{args[1]}.rb")
|
113
|
+
|
114
|
+
when args[0] == "cluster"
|
115
|
+
data_bag = File.join( "data_bags", "clusters", "#{$cluster[:id]}.json" )
|
116
|
+
if File.exists?( data_bag ) then
|
117
|
+
if not options[:f] then
|
118
|
+
raise "Cluster found: #{data_bag}"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
data_bag_dir = File.join( "data_bags", "clusters" )
|
122
|
+
Dir.mkdir(data_bag_dir) unless File.exists?(data_bag_dir)
|
123
|
+
File.open( data_bag, 'w' ) do |f|
|
124
|
+
f.write( $cluster.to_json )
|
125
|
+
end
|
126
|
+
system("knife data bag create clusters")
|
127
|
+
system("knife data bag from file clusters #{$cluster[:id]}.json")
|
105
128
|
end
|
106
129
|
|
107
130
|
puts "upload command ran"
|
data/lib/noc.rb
CHANGED
data/lib/noc/version.rb
CHANGED