vmc_knife 0.0.40 → 0.0.45

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/README.md CHANGED
@@ -20,7 +20,7 @@ load the cloudfoundry profile and install the gem:
20
20
 
21
21
  Or to install from source:
22
22
 
23
- git clone https://github.com/hmalphettes/vmc-knife.git
23
+ git clone https://github.com/intalio/vmc-knife.git
24
24
  cd vmc-knife
25
25
  gem build vmc_knife.gemspec
26
26
  gem install vmc_knife
@@ -8,17 +8,17 @@ require 'cli' #this is the cli from vmc.
8
8
  # as well as a short declaration of the services expected and their nature.
9
9
  # Usage: edit the json recipe.
10
10
  # vmc_knife configure-applications
11
- #
11
+ #
12
12
  # Also bundles utilities to reconfigure the hostname of the cloud_controller and the gateways accordingly:
13
13
  # vmc_knife configure-vcap
14
14
  # and publish the urls in the deployed apps with zeroconf on ubuntu (avahi)
15
15
  # vmc configure-vcap-mdns
16
16
  class VMC::Cli::KnifeRunner < VMC::Cli::Runner
17
-
17
+
18
18
  def parse_command!
19
19
  # just return if already set, happends with -v, -h
20
20
  return if @namespace && @action
21
-
21
+
22
22
  verb = @args.first
23
23
  case verb
24
24
 
@@ -241,13 +241,21 @@ class VMC::Cli::KnifeRunner < VMC::Cli::Runner
241
241
  when 'update-self'
242
242
  usage('vmc_knife update-self')
243
243
  puts "Updating vmc-knife"
244
- `cd /tmp; [ -d "vmc-knife" ] && rm -rf vmc-knife; git clone https://github.com/hmalphettes/vmc-knife.git; cd vmc-knife; gem build vmc_knife.gemspec; gem install vmc_knife`
244
+ `cd /tmp; [ -d "vmc-knife" ] && rm -rf vmc-knife; git clone https://github.com/intalio/vmc-knife.git; cd vmc-knife; gem build vmc_knife.gemspec; gem install vmc_knife`
245
245
  exit 0
246
+ when 'app-version'
247
+ usage('vmc_knife app-version [<applications_regexp>]')
248
+ @args.shift # consumes the argument.
249
+ if @args.size <= 2
250
+ set_cmd(:knifeapps, :applications_version, @args.size)
251
+ else
252
+ set_cmd(:knifeapps, :applications_version, @args.size) # too many
253
+ end
246
254
  when 'help'
247
255
  display "vmc_knife expand-manifest|login|start/stop/restart-apps|upload-apps|configure-all|configure-recipes|configure-apps|configure-services|info-configure-apps|info-apps|update-apps|patch-apps|running-apps|wait-till-running-apps|delete-app/data/all|configure-vcap|configure-vcap-mdns|configure-vcap-etc-hosts|data-shell|data-export/import/shrink/drop|logs-less|less|tail|logs-all/apps/vcap|update-self [<manifest_path>]"
248
256
  else
249
257
  super
250
258
  end
251
259
  end
252
-
260
+
253
261
  end
@@ -1,7 +1,7 @@
1
1
  # Commands for vmc_knife.
2
2
 
3
3
  module VMC::KNIFE::Cli
4
-
4
+
5
5
  #loads the manifest file.
6
6
  #when the path is not specified, look in the current directory.
7
7
  #when the path is a directory, look for the first json file it can find.
@@ -36,9 +36,9 @@ module VMC::Cli::Command
36
36
 
37
37
  class Knife < Base
38
38
  include VMC::KNIFE::Cli
39
-
39
+
40
40
  # expands the json manifest. outputs it in the destination path.
41
-
41
+
42
42
  def expand_manifest(manifest_file_path=ENV['VMC_KNIFE_DEFAULT_RECIPE'], destination=nil)
43
43
  res = VMC::KNIFE::JSON_EXPANDER.expand_json manifest_file_path
44
44
  if destination
@@ -49,11 +49,11 @@ module VMC::Cli::Command
49
49
  File.open(destination, 'w') {|f| f.write(JSON.pretty_generate(res)) }
50
50
  else
51
51
  STDERR.puts "Expanding the manifest #{manifest_file_path}"
52
- STDOUT.puts JSON.pretty_generate(res)
52
+ STDOUT.puts JSON.pretty_generate(res)
53
53
  end
54
-
54
+
55
55
  end
56
-
56
+
57
57
  # updates the cloud_controller
58
58
  def configure_cloud_controller(cloud_controller_yml=nil,manifest_file_path_or_uri=nil)
59
59
  __update(manifest_file_path_or_uri,cloud_controller_yml,VMC::KNIFE::VCAPUpdateCloudControllerConfig,"cloud_controller")
@@ -61,7 +61,7 @@ module VMC::Cli::Command
61
61
  # updates /etc/hosts
62
62
  def configure_etc_hosts(etc_hosts=nil,manifest_file_path=nil,client=nil)
63
63
  #__update(manifest_file_path_or_uri,etc_hosts,VMC::KNIFE::VCAPUpdateEtcHosts,"/etc/hosts")
64
-
64
+
65
65
  # this will configure /etc/hosts with the urls of your applications as well as the cloudcontroller.
66
66
  # it is not be necessary if avahi is correctly configured on your VM.
67
67
  unless manifest_file_path.nil?
@@ -92,7 +92,7 @@ module VMC::Cli::Command
92
92
  update_aliases.do_exec = true
93
93
  update_aliases.execute
94
94
  end
95
-
95
+
96
96
  def configure_all(manifest_file_path_or_uri=nil)
97
97
  begin
98
98
  display "Stop applications ..."
@@ -144,30 +144,30 @@ module VMC::Cli::Command
144
144
  end
145
145
 
146
146
  end
147
-
147
+
148
148
  class Knifemisc < Misc
149
149
  include VMC::KNIFE::Cli
150
-
150
+
151
151
  # configures the target and login according to the info in the manifest.
152
152
  def login(manifest_file_path=nil)
153
153
  man = load_manifest(manifest_file_path)
154
154
  target_url = man['target']
155
- raise "No target defined in the manifest #{@manifest_path}" if target_url.nil?
155
+ raise "No target defined in the manifest #{@manifest_path}" if target_url.nil?
156
156
  puts "set_target #{target_url}"
157
157
  set_target(target_url)
158
-
158
+
159
159
  email = man['email']
160
160
  password = man['password']
161
161
  @options[:email] = email if email
162
162
  @options[:password] = password if password
163
-
163
+
164
164
  tries ||= 0
165
165
  # login_and_save_token:
166
-
166
+
167
167
  puts "login with #{email} #{password}"
168
168
  token = client.login(email, password)
169
169
  VMC::Cli::Config.store_token(token)
170
-
170
+
171
171
  rescue VMC::Client::TargetError
172
172
  display "Problem with login, invalid account or password.".red
173
173
  retry if (tries += 1) < 3 && prompt_ok && !@options[:password]
@@ -176,11 +176,11 @@ module VMC::Cli::Command
176
176
  display "Problem with login, #{e}, try again or register for an account.".red
177
177
  display e.backtrace
178
178
  exit 1
179
-
179
+
180
180
  end
181
-
181
+
182
182
  end
183
-
183
+
184
184
  class Knifeapps < Apps
185
185
  include VMC::KNIFE::Cli
186
186
 
@@ -195,7 +195,7 @@ module VMC::Cli::Command
195
195
  def configure_recipes(recipe_names_regexp=nil,manifest_file_path=nil)
196
196
  configure(recipe_names_regexp,nil,nil,manifest_file_path)
197
197
  end
198
-
198
+
199
199
  # Configure the applications according to their manifest.
200
200
  # The parameters are related to selecting a subset of the applications to configure.
201
201
  # nil means all apps for all recipes found in the manifest are configured.
@@ -284,7 +284,7 @@ module VMC::Cli::Command
284
284
  end
285
285
  end
286
286
  recipe_configuror(:shell,nil,nil,data_names_regexp,manifest_file_path,
287
- {:file_name=>file_name, :data_cmd=>cmd,
287
+ {:file_name=>file_name, :data_cmd=>cmd,
288
288
  :app_name=>app_name, :data_only=>true,
289
289
  :single_service=>true})
290
290
  end
@@ -334,7 +334,11 @@ module VMC::Cli::Command
334
334
  {:apps_only=>true, :log_apps=>true, :log_vcap=>false, :logs_shell=>"tail",
335
335
  :log_files_glob=>log_files_glob})
336
336
  end
337
-
337
+ def applications_version(app_names_regexp=nil,manifest_file_path=nil)
338
+ recipe_configuror(:version,nil,app_names_regexp,nil,manifest_file_path,
339
+ {:apps_only=>true})
340
+ end
341
+
338
342
  def recipe_configuror(method_sym_name,recipes_regexp=nil,app_names_regexp=nil,service_names_regexp=nil,manifest_file_path=nil,opts=nil)
339
343
  man = load_manifest(manifest_file_path)
340
344
  recipes_regexp = as_regexp(recipes_regexp)
@@ -347,7 +351,7 @@ module VMC::Cli::Command
347
351
  method_object = configurer.method(method_sym_name)
348
352
  method_object.call
349
353
  end
350
-
354
+
351
355
  def as_regexp(arg, strict=false)
352
356
  if arg != nil && arg.kind_of?(String) && !arg.strip.empty?
353
357
  if strict && Regexp.quote(arg) == arg
@@ -357,7 +361,7 @@ module VMC::Cli::Command
357
361
  end
358
362
  end
359
363
  end
360
-
364
+
361
365
  end
362
-
366
+
363
367
  end
@@ -2,7 +2,7 @@ module VMC
2
2
  module KNIFE
3
3
  module Cli
4
4
  # This version number is used as the RubyGem release version.
5
- VERSION = '0.0.01'
5
+ VERSION = '0.0.45'
6
6
  end
7
7
  end
8
8
  end
@@ -4,7 +4,7 @@ require 'yaml'
4
4
 
5
5
  module VMC
6
6
  module KNIFE
7
-
7
+
8
8
  # Read/Write the JSON for a recipe.
9
9
  # Does not map the actual JSON into a new ruby object.
10
10
  class Root
@@ -47,9 +47,9 @@ module VMC
47
47
  def to_json()
48
48
  @wrapped.to_json
49
49
  end
50
-
50
+
51
51
  end
52
-
52
+
53
53
  class Recipe
54
54
  attr_accessor :wrapped, :root
55
55
  # root: Root
@@ -82,14 +82,14 @@ module VMC
82
82
  res << DataService.new(@root, service, name) if regexp =~ name
83
83
  end
84
84
  res
85
-
85
+
86
86
  end
87
87
  def to_json()
88
88
  @wrapped.to_json
89
89
  end
90
-
90
+
91
91
  end
92
-
92
+
93
93
  # Read/Write the JSON for a dataservice.
94
94
  # Does not map the actual JSON into a new ruby object.
95
95
  class DataService
@@ -106,16 +106,16 @@ module VMC
106
106
  def vendor()
107
107
  @wrapped['vendor']
108
108
  end
109
-
109
+
110
110
  # Returns a vcap manifest that can be used
111
111
  # to create a new data-service to vcap's cloud_controller.
112
112
  def to_vcap_manifest()
113
113
  #TODO
114
114
  @wrapped
115
115
  end
116
-
116
+
117
117
  end
118
-
118
+
119
119
  # Read/Write the JSON for an application.
120
120
  # Does not map the actual JSON into a new ruby object.
121
121
  class Application
@@ -138,7 +138,7 @@ module VMC
138
138
  def env()
139
139
  ApplicationEnvironment.new @wrapped['env'], self
140
140
  end
141
-
141
+
142
142
  # Returns a vcap manifest that can be used
143
143
  # to push/update an application to vcap's cloud_controller.
144
144
  def to_vcap_manifest()
@@ -146,7 +146,7 @@ module VMC
146
146
  # if there are differences we will take care of them here.
147
147
  @wrapped
148
148
  end
149
-
149
+
150
150
  # look for the log folder of the deployed app.
151
151
  # making the assumption we are on the same file system.
152
152
  # will use the paas APIs later.
@@ -201,7 +201,7 @@ module VMC
201
201
  end
202
202
 
203
203
  end
204
-
204
+
205
205
  # Read/Write the application environment. a list of strings
206
206
  # where the first '=' character separate the key and values.
207
207
  class ApplicationEnvironment
@@ -210,7 +210,7 @@ module VMC
210
210
  @wrapped = data
211
211
  @application = application
212
212
  end
213
- #Sets a variable. Replaces other environment variables with the
213
+ #Sets a variable. Replaces other environment variables with the
214
214
  #same name if there is such a thing.
215
215
  def set(name,value)
216
216
  foundit = false
@@ -245,7 +245,7 @@ module VMC
245
245
  @wrapped << "#{name}=#{value}"
246
246
  end
247
247
  end
248
-
248
+
249
249
  class RecipesConfigurationApplier
250
250
  attr_accessor :root, :client, :applications, :recipes, :data_services, :opts
251
251
  # Select the applications and data-services to configure according to the values
@@ -350,7 +350,7 @@ module VMC
350
350
  end
351
351
  def info()
352
352
  configure_only=@opts[:configure_only] || false
353
- if configure_only
353
+ if configure_only
354
354
  if updates_pending().empty?
355
355
  puts "All configuration up to date: true"
356
356
  return true
@@ -372,7 +372,7 @@ module VMC
372
372
  @applications.each do |application|
373
373
  application_updater = ApplicationManifestApplier.new application, @client
374
374
  application_updater.delete
375
- end
375
+ end
376
376
  @data_services.each do |data_service|
377
377
  data_service_updater = DataServiceManifestApplier.new data_service, @client, @current_services, @current_services_info
378
378
  data_service_updater.delete
@@ -538,6 +538,17 @@ module VMC
538
538
  `rm #{output_file}` unless @opts[:output_file]
539
539
  end
540
540
  end
541
+ def version()
542
+ versions = {}
543
+ @applications.each do |application|
544
+ application_updater = ApplicationManifestApplier.new(application, @client)
545
+ ver = application_updater.version_installed()
546
+ puts "#{application.name()} => #{ver}" if VMC::Cli::Config.trace
547
+ versions[application.name()] = ver
548
+ end
549
+ puts versions
550
+ versions
551
+ end
541
552
  end
542
553
  class DataServiceManifestApplier
543
554
  attr_accessor :data_service_json, :client, :current_services, :current_services_info
@@ -564,7 +575,7 @@ module VMC
564
575
  end
565
576
  @current ||= Hash.new # that would be a new service.
566
577
  end
567
-
578
+
568
579
  # Only for testing: inject json
569
580
  def __set_current(current,current_services=nil,current_services_info=nil)
570
581
  @current = current
@@ -612,9 +623,9 @@ module VMC
612
623
  end
613
624
  raise "vcap does not provide a data-service which vendor is #{searched_vendor}"
614
625
  end
615
-
616
-
617
- end
626
+
627
+
628
+ end
618
629
  class ApplicationManifestApplier
619
630
  attr_accessor :application_json, :client, :current_name
620
631
  # @param application The application object as defined in the SaaS manifest
@@ -634,7 +645,7 @@ module VMC
634
645
  @current_name ||= @application_json['old_name']
635
646
  @current_name ||= @application_json['name']
636
647
  end
637
-
648
+
638
649
  def safe_app_info(name)
639
650
  begin
640
651
  return @client.app_info(name)
@@ -643,19 +654,19 @@ module VMC
643
654
  return
644
655
  end
645
656
  end
646
-
657
+
647
658
  def current()
648
659
  return @current unless @current.nil?
649
660
  @current = safe_app_info(@current_name)
650
661
  @current ||= safe_app_info(@application_json['name']) # in case the rename occurred already.
651
662
  @current ||= Hash.new # that would be a new app.
652
663
  end
653
-
664
+
654
665
  # Only for testing: inject json
655
666
  def __set_current(current)
656
667
  @current = current
657
668
  end
658
-
669
+
659
670
  def execute()
660
671
  diff = updates_pending()
661
672
  if diff && diff.size > 0
@@ -667,10 +678,10 @@ module VMC
667
678
  puts "Updating #{@application_json['name']} with #{updated_manifest.inspect}"
668
679
  @client.update_app(@application_json['name'], updated_manifest)
669
680
  end
670
-
681
+
671
682
  end
672
683
  end
673
-
684
+
674
685
  def version_available()
675
686
  return unless @application_json['repository']
676
687
  if @application_json['repository']['version_available'] && @application_json['repository']['version_available']['url']
@@ -724,7 +735,7 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
724
735
  staged_hash.strip! if staged_hash
725
736
  staged_hash
726
737
  end
727
-
738
+
728
739
  def version_available_file_path(prefix_app_by_default=true)
729
740
  # extract the file that contains the version from that tar.gz
730
741
  version_available_file=@application_json['repository']['version_installed']['staged_entry'] if @application_json['repository']['version_installed']
@@ -745,10 +756,10 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
745
756
  version_available_file=version_available_file['app/'.length..-1]
746
757
  elsif version_available_file.start_with?('tomcat/webapp/ROOT/') && !prefix_app_by_default
747
758
  version_available_file=version_available_file['tomcat/webapp/ROOT/'.length..-1]
748
- end
759
+ end
749
760
  end
750
761
  version_available_file
751
- end
762
+ end
752
763
 
753
764
  def cmd_read_version_installed()
754
765
  cmd=@application_json['repository']['version_installed']['cmd'] if @application_json['repository']['version_installed']
@@ -802,13 +813,13 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
802
813
  if File.exist?(version_available_file)
803
814
  `cp #{version_available_file} #{droplet_dot_version}`
804
815
  else
805
- put "Could not find the installed version file here: here #{droplet} // #{version_available_file}" if VMC::Cli::Config.trace
816
+ puts "Could not find the installed version file here: here #{droplet} // #{version_available_file}" if VMC::Cli::Config.trace
806
817
  end
807
818
  end
808
819
  end
809
820
  installed_version=read_version(droplet_dot_version,cmd)
810
821
  end
811
-
822
+
812
823
  def info()
813
824
  app_id=ccdb_app_id()
814
825
  if app_id
@@ -825,7 +836,7 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
825
836
  return installed_v == available_v if installed_v && available_v
826
837
  return false
827
838
  end
828
-
839
+
829
840
  def wget_args()
830
841
  _wget_args = @application_json['repository']['wget_args']
831
842
  if _wget_args.nil?
@@ -837,7 +848,7 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
837
848
  end
838
849
  wget_args_str
839
850
  end
840
-
851
+
841
852
  def update(force=false)
842
853
  raise "The application #{@application_json['name']} does not exist yet" if current().empty?
843
854
  do_delete_download=false
@@ -847,7 +858,7 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
847
858
  available_version=version_available()
848
859
  p "#{@current_name} available_version #{available_version}"
849
860
  if installed_version == available_version
850
- puts "The staged version of #{@current_name} is the same than the one on the remote repository"
861
+ puts "The staged version of #{@current_name} is the same as the one on the remote repository"
851
862
  return unless force
852
863
  puts "Forced download"
853
864
  end
@@ -858,10 +869,10 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
858
869
  end
859
870
  upload(force,do_delete_download)
860
871
  end
861
-
872
+
862
873
  def app_download_dir_path()
863
874
  "#{ENV['HOME']}/vmc_knife_downloads/#{@application_json['name']}"
864
- end
875
+ end
865
876
  def extract_deployed(force=false)
866
877
  installed_v=version_installed()
867
878
  unless installed_v
@@ -890,28 +901,29 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
890
901
  p "The version installed and the version ready to deploy are identical: #{installed_v}"
891
902
  end
892
903
  else
893
- do_extract = true
904
+ do_extract = true
894
905
  end
895
906
  if do_extract
896
- FileUtils.mkdir_p app_download_dir
907
+ FileUtils.mkdir_p app_download_dir
897
908
  drop_f_p=droplet_file_path()
898
909
  p "tar -xzvf #{drop_f_p}"
899
910
  `cd /tmp; [ -d drop_app ] && rm -rf drop_app; mkdir drop_app; cd drop_app; tar -xzvf #{drop_f_p}; [ -d app ] && mv app/* #{app_download_dir} || mv tomcat/webapps/ROOT/* #{app_download_dir}`
900
911
  p "Done. ls -la #{app_download_dir}"
901
- `ls -la #{app_download_dir}`
902
- end
903
- end
912
+ `ls -la #{app_download_dir}`
913
+ end
914
+ do_extract
915
+ end
904
916
  def upload(force=false,do_delete_download=false)
905
917
  raise "The application #{@application_json['name']} does not exist yet" if current().empty?
906
918
  return unless @application_json['repository']
907
919
  url = @application_json['repository']['url']
908
-
920
+
909
921
  Dir.chdir(ENV['HOME']) do
910
922
  tmp_download_filename="_download_.zip"
911
923
  app_download_dir=app_download_dir_path()
912
924
  `rm -rf #{app_download_dir}` if File.exist?("#{app_download_dir}") && do_delete_download
913
925
  `rm -rf #{app_download_dir}` if File.exist? "#{app_download_dir}/#{tmp_download_filename}"
914
-
926
+
915
927
  FileUtils.mkdir_p app_download_dir
916
928
  Dir.chdir(app_download_dir) do
917
929
  if Dir.entries(Dir.pwd).size == 2 #empty directory ?
@@ -924,7 +936,7 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
924
936
  branch='master'
925
937
  end
926
938
  `git pull origin #{branch}`
927
- else
939
+ else
928
940
  begin
929
941
  wget_args_str = wget_args()
930
942
  #`wget #{wget_args_str} --output-document=#{tmp_download_filename} #{url}`
@@ -964,7 +976,7 @@ wget #{wget_args()} --output-document=$version_built_download #{version_availabl
964
976
  end
965
977
  end
966
978
  end
967
-
979
+
968
980
  def upload_app_bits()
969
981
  Dir.chdir(app_download_dir_path()) do
970
982
  puts "upload_app_bits in #{app_download_dir_path()}"
@@ -975,38 +987,43 @@ puts "upload_app_bits in #{app_download_dir_path()}"
975
987
  FileUtils.rm_rf(tmp_git) if File.exists?(tmp_git)
976
988
  FileUtils.mv(".git", tmp_git)
977
989
  end
990
+ ori_trace = VMC::Cli::Config.trace
978
991
  begin
979
- VMC::KNIFE::HELPER.static_upload_app_bits(@client,@application_json['name'],Dir.pwd)
992
+ VMC::KNIFE::HELPER.static_upload_app_bits(@client,@application_json['name'],Dir.pwd)
980
993
  rescue
981
994
  FileUtils.mv(tmp_git, ".git") if File.exists?(tmp_git)
995
+ ensure
996
+ VMC::Cli::Config.trace = ori_trace
982
997
  end
983
998
  end
984
- end
999
+ end
985
1000
 
986
1001
  def patch(force=false)
987
- extract_deployed(force)
988
- app_download_dir=app_download_dir_path()
1002
+ app_download_dir=app_download_dir_path()
1003
+ app_was_extracted = extract_deployed(force)
989
1004
  p "Application ready to be patched in #{app_download_dir}"
990
- p "Type y when ready to update. Anything else will stop."
991
- ans = STDIN.gets.chomp
992
- return unless ans && ans.capitalize.start_with?('Y')
1005
+ if VMC::Cli::Config.trace || app_was_extracted
1006
+ p "Type y when ready to update. Anything else will stop."
1007
+ ans = STDIN.gets.chomp
1008
+ return unless ans && ans.capitalize.start_with?('Y')
1009
+ end
993
1010
  upload_app_bits()
994
1011
  end
995
-
1012
+
996
1013
  def start()
997
1014
  #raise "The application #{@application_json['name']} does not exist yet" if current().empty?
998
1015
  return if current().empty? || current[:state] == 'STARTED'
999
1016
  current[:state] = 'STARTED'
1000
1017
  client.update_app(@application_json['name'], current())
1001
1018
  end
1002
-
1019
+
1003
1020
  def stop()
1004
1021
  #raise "The application #{@application_json['name']} does not exist yet" if current().empty?
1005
1022
  return if current().empty? || current[:state] == 'STOPPED'
1006
1023
  current[:state] = 'STOPPED'
1007
1024
  client.update_app(@application_json['name'], current())
1008
1025
  end
1009
-
1026
+
1010
1027
  def delete()
1011
1028
  if current().empty?
1012
1029
  puts "The application #{@application_json['name']} does not exist yet" if VMC::Cli::Config.trace
@@ -1041,7 +1058,7 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1041
1058
  end
1042
1059
  new_app_manifest
1043
1060
  end
1044
-
1061
+
1045
1062
  # Returns a json object where we see the differences.
1046
1063
  def updates_pending()
1047
1064
  name = update_name_pending()
@@ -1059,7 +1076,7 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1059
1076
  updates['meta'] = meta if meta
1060
1077
  updates unless updates.empty?
1061
1078
  end
1062
-
1079
+
1063
1080
  def update_name_pending()
1064
1081
  curr_name=current[:name] || current['name']
1065
1082
  if curr_name.nil?
@@ -1122,13 +1139,13 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1122
1139
  old_debug = old_meta[:debug] || old_meta['debug']
1123
1140
  new_debug = new_meta['debug']
1124
1141
  debug_change = "#{old_debug} => #{new_debug}" if old_debug != new_debug
1125
-
1142
+
1126
1143
  old_restage_on_service_change = old_meta[:restage_on_service_change]
1127
1144
  old_restage_on_service_change = old_meta['restage_on_service_change'] unless old_restage_on_service_change == false
1128
1145
  old_restage_on_service_change = old_restage_on_service_change.to_s unless old_restage_on_service_change.nil?
1129
1146
  new_restage_on_service_change = new_meta['restage_on_service_change']
1130
1147
  restage_on_service_change_change = "#{old_restage_on_service_change} => #{new_restage_on_service_change}" if old_restage_on_service_change != new_restage_on_service_change
1131
-
1148
+
1132
1149
  return if debug_change.nil? && restage_on_service_change_change.nil?
1133
1150
  return { "debug" => debug_change } if restage_on_service_change_change.nil?
1134
1151
  return { "restage_on_service_change" => restage_on_service_change_change } if debug_change.nil?
@@ -1151,7 +1168,7 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1151
1168
  return { "add" => add, "remove" => remove }
1152
1169
  end
1153
1170
  end
1154
-
1171
+
1155
1172
  # This is really a server-side vcap admin feature.
1156
1173
  class VCAPUpdateCloudControllerConfig
1157
1174
  def initialize(uri, cloud_controller_config=nil)
@@ -1192,7 +1209,7 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1192
1209
  def execute()
1193
1210
  @changed = false
1194
1211
  @changed_gateways = Array.new
1195
- # look for the line that starts with external_uri:
1212
+ # look for the line that starts with external_uri:
1196
1213
  # replace it with the new uri if indeed there was a change.
1197
1214
  lines = IO.readlines @config
1198
1215
  File.open(@config, "w") do |file|
@@ -1234,7 +1251,7 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1234
1251
  @changed
1235
1252
  end
1236
1253
  end
1237
-
1254
+
1238
1255
  # This is really a server-side feature.
1239
1256
  # Replace the 127.0.0.1 localhost #{old_uri} with the new uri
1240
1257
  class VCAPUpdateEtcHosts
@@ -1281,7 +1298,7 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1281
1298
  def execute()
1282
1299
  return unless update_pending
1283
1300
  @changed = false
1284
- # look for the line that starts with external_uri:
1301
+ # look for the line that starts with external_uri:
1285
1302
  # replace it with the new uri if indeed there was a change.
1286
1303
  if true
1287
1304
  # use sudo.
@@ -1307,7 +1324,7 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1307
1324
  @changed
1308
1325
  end
1309
1326
  end
1310
-
1327
+
1311
1328
  # This is really a server-side feature.
1312
1329
  # This is deprecated; use the dns_publisher vcap module instead.
1313
1330
  # Regenerates the urls to publish as aliases.
@@ -1391,6 +1408,6 @@ puts "upload_app_bits in #{app_download_dir_path()}"
1391
1408
  return length_already != allall.length
1392
1409
  end
1393
1410
  end
1394
-
1411
+
1395
1412
  end # end of KNIFE
1396
1413
  end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vmc_knife
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.40
4
+ version: 0.0.45
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Intalio Pte
8
+ - Intalio, Inc.
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-08-29 00:00:00.000000000 Z
12
+ date: 2012-10-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: vmc
16
- requirement: &28784440 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: 0.3.18
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *28784440
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 0.3.18
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: rest-client
27
- requirement: &28783860 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -35,31 +40,49 @@ dependencies:
35
40
  version: 1.7.0
36
41
  type: :runtime
37
42
  prerelease: false
38
- version_requirements: *28783860
43
+ version_requirements: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: 1.6.1
49
+ - - <
50
+ - !ruby/object:Gem::Version
51
+ version: 1.7.0
39
52
  - !ruby/object:Gem::Dependency
40
53
  name: rspec
41
- requirement: &29208120 !ruby/object:Gem::Requirement
54
+ requirement: !ruby/object:Gem::Requirement
42
55
  none: false
43
56
  requirements:
44
57
  - - ~>
45
58
  - !ruby/object:Gem::Version
46
- version: 1.3.0
59
+ version: 2.4.0
47
60
  type: :development
48
61
  prerelease: false
49
- version_requirements: *29208120
62
+ version_requirements: !ruby/object:Gem::Requirement
63
+ none: false
64
+ requirements:
65
+ - - ~>
66
+ - !ruby/object:Gem::Version
67
+ version: 2.4.0
50
68
  - !ruby/object:Gem::Dependency
51
69
  name: webmock
52
- requirement: &29206780 !ruby/object:Gem::Requirement
70
+ requirement: !ruby/object:Gem::Requirement
53
71
  none: false
54
72
  requirements:
55
- - - =
73
+ - - '='
56
74
  - !ruby/object:Gem::Version
57
75
  version: 1.5.0
58
76
  type: :development
59
77
  prerelease: false
60
- version_requirements: *29206780
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ none: false
80
+ requirements:
81
+ - - '='
82
+ - !ruby/object:Gem::Version
83
+ version: 1.5.0
61
84
  description: Extensions for VMC the CLI of VMWare's Cloud Foundry
62
- email: hmalphettes@gmail.com
85
+ email: eng-support@intalio.com
63
86
  executables:
64
87
  - vmc_knife
65
88
  extensions: []
@@ -70,17 +93,16 @@ files:
70
93
  - LICENSE
71
94
  - README.md
72
95
  - lib/restclient/restclient_add_timeout.rb
73
- - lib/vmc_knife/json_expander.rb
74
- - lib/vmc_knife/data_services.rb
75
- - lib/vmc_knife/commands/knife_cmds.rb
76
- - lib/vmc_knife/vmc_knife.rb
77
96
  - lib/vmc_knife/cli_extensions.rb
97
+ - lib/vmc_knife/commands/knife_cmds.rb
98
+ - lib/vmc_knife/data_services.rb
99
+ - lib/vmc_knife/json_expander.rb
78
100
  - lib/vmc_knife/mongo/mongo_cmd.js.erb
79
101
  - lib/vmc_knife/version.rb
80
102
  - lib/vmc_knife/vmc_helper.rb
103
+ - lib/vmc_knife/vmc_knife.rb
81
104
  - lib/vmc_knife.rb
82
- - !binary |-
83
- YmluL3ZtY19rbmlmZQ==
105
+ - bin/vmc_knife
84
106
  homepage: http://intalio.com
85
107
  licenses: []
86
108
  post_install_message:
@@ -101,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
101
123
  version: '0'
102
124
  requirements: []
103
125
  rubyforge_project:
104
- rubygems_version: 1.8.15
126
+ rubygems_version: 1.8.24
105
127
  signing_key:
106
128
  specification_version: 3
107
129
  summary: Extensions for VMC the CLI of VMWare's Cloud Foundry