vmc_knife 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/vmc_knife/commands/knife_cmds.rb +1 -1
- data/lib/vmc_knife/vmc_knife.rb +16 -15
- metadata +3 -3
@@ -76,7 +76,7 @@ module VMC::Cli::Command
|
|
76
76
|
# updates /etc/avahi/aliases
|
77
77
|
def configure_etc_avahi_aliases(etc_avahi_aliases=nil,manifest_file_path=nil)
|
78
78
|
man = load_manifest(manifest_file_path)
|
79
|
-
update_aliases = VMC::KNIFE::VCAPUpdateAvahiAliases.new(etc_avahi_aliases,man,client)
|
79
|
+
update_aliases = VMC::KNIFE::VCAPUpdateAvahiAliases.new(etc_avahi_aliases,man,client,/.*/)
|
80
80
|
update_aliases.do_exec = true
|
81
81
|
update_aliases.execute
|
82
82
|
end
|
data/lib/vmc_knife/vmc_knife.rb
CHANGED
@@ -496,28 +496,28 @@ module VMC
|
|
496
496
|
updates['services'] = services if services
|
497
497
|
updates['env'] = services if services
|
498
498
|
updates['uris'] = uris if uris
|
499
|
-
updates['
|
499
|
+
updates['memory'] = memory if memory
|
500
500
|
updates unless updates.empty?
|
501
501
|
end
|
502
502
|
|
503
503
|
def update_name_pending()
|
504
|
-
if current[
|
504
|
+
if current[:name].nil?
|
505
505
|
return "Create #{@application_json['name']}"
|
506
506
|
end
|
507
|
-
if @application_json['name'] != @current[
|
508
|
-
return "#{@current[
|
507
|
+
if @application_json['name'] != @current[:name]
|
508
|
+
return "#{@current[:name]} => #{@application_json['name']}"
|
509
509
|
end
|
510
510
|
end
|
511
511
|
def update_memory_pending()
|
512
|
-
old_mem = current[
|
512
|
+
old_mem = current[:resources][:memory] unless current[:resources].nil?
|
513
513
|
new_mem = @application_json['resources']['memory'] unless @application_json['resources'].nil?
|
514
514
|
if old_mem != new_mem
|
515
515
|
return "#{old_mem} => #{new_mem}"
|
516
516
|
end
|
517
517
|
end
|
518
518
|
def update_staging_pending()
|
519
|
-
old_model = current[
|
520
|
-
old_stack = current[
|
519
|
+
old_model = current[:staging][:model] unless current[:staging].nil?
|
520
|
+
old_stack = current[:staging][:stack] unless current[:staging].nil?
|
521
521
|
new_model = @application_json['staging']['model'] unless @application_json['staging'].nil?
|
522
522
|
new_stack = @application_json['staging']['stack'] unless @application_json['staging'].nil?
|
523
523
|
if old_model != new_model
|
@@ -532,17 +532,17 @@ module VMC
|
|
532
532
|
return { "stack" => stack_change, "model" => model_change }
|
533
533
|
end
|
534
534
|
def update_services_pending()
|
535
|
-
old_services = current[
|
535
|
+
old_services = current[:services]
|
536
536
|
new_services = @application_json['services']
|
537
537
|
diff_lists(old_services,new_services)
|
538
538
|
end
|
539
539
|
def update_env_pending()
|
540
|
-
old_services = current[
|
540
|
+
old_services = current[:env]
|
541
541
|
new_services = @application_json['env']
|
542
542
|
diff_lists(old_services,new_services)
|
543
543
|
end
|
544
544
|
def update_uris_pending()
|
545
|
-
old_services = current[
|
545
|
+
old_services = current[:uris]
|
546
546
|
new_services = @application_json['uris']
|
547
547
|
diff_lists(old_services,new_services)
|
548
548
|
end
|
@@ -702,12 +702,13 @@ module VMC
|
|
702
702
|
# Regenerates the urls to publish as aliases.
|
703
703
|
# use vmc apps to read the uris of each app and also the manifest.
|
704
704
|
class VCAPUpdateAvahiAliases
|
705
|
-
attr_accessor :do_exec
|
706
|
-
def initialize(avahi_aliases_path=nil, manifest_path=nil,client=nil)
|
705
|
+
attr_accessor :do_exec, :uri_filter
|
706
|
+
def initialize(avahi_aliases_path=nil, manifest_path=nil,client=nil,uri_filter=nil)
|
707
707
|
@manifest_path = manifest_path
|
708
708
|
@client = client
|
709
709
|
@config = avahi_aliases_path
|
710
710
|
@config ||= '/etc/avahi/aliases'
|
711
|
+
@uri_filter = uri_filter||/\.local$/
|
711
712
|
end
|
712
713
|
def apps_uris()
|
713
714
|
return @apps_uris unless @apps_uris.nil?
|
@@ -715,11 +716,11 @@ module VMC
|
|
715
716
|
return uris unless @client
|
716
717
|
apps = @client.apps
|
717
718
|
api_uri = URI.parse(@client.target).host
|
718
|
-
uris << api_uri if
|
719
|
+
uris << api_uri if @uri_filter =~ api_uri
|
719
720
|
apps.each do |app|
|
720
721
|
app[:uris].each do |uri|
|
721
722
|
#only publish the uris in the local domain.
|
722
|
-
uris << uri if
|
723
|
+
uris << uri if @uri_filter =~ uri
|
723
724
|
end
|
724
725
|
end
|
725
726
|
uris.uniq!
|
@@ -734,7 +735,7 @@ module VMC
|
|
734
735
|
root.recipes.each do |recipe|
|
735
736
|
recipe.applications.each do |application|
|
736
737
|
application.uris.each do |uri|
|
737
|
-
uris << uri if
|
738
|
+
uris << uri if @uri_filter =~ uri
|
738
739
|
end
|
739
740
|
end
|
740
741
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vmc_knife
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Intalio Pte
|