lib/vagrant-vcloud/action/inventory_check.rb in vagrant-vcloud-0.1.0 vs lib/vagrant-vcloud/action/inventory_check.rb in vagrant-vcloud-0.1.1
- old
+ new
@@ -25,21 +25,22 @@
boxDir = env[:machine].box.directory.to_s
boxFile = env[:machine].box.name.to_s
boxOVF = "#{boxDir}/#{boxFile}.ovf"
- ### Still relying on ruby-progressbar because report_progress basically sucks.
+ # Still relying on ruby-progressbar because report_progress basically sucks.
@logger.debug("OVF File: #{boxOVF}")
uploadOVF = cnx.upload_ovf(
cfg.vdc_id,
env[:machine].box.name.to_s,
"Vagrant Box",
boxOVF,
cfg.catalog_id,
{
:progressbar_enable => true
+ # FIXME: export chunksize as a parameter and lower the default to 1M.
#:chunksize => 262144
}
)
env[:ui].info("Adding [#{env[:machine].box.name.to_s}] to Catalog [#{cfg.catalog_name}]")
@@ -47,11 +48,11 @@
if !addOVFtoCatalog[:errormsg].nil?
raise Errors::CatalogAddError, :message => addOVFtoCatalog[:errormsg]
end
- ## Retrieve catalog_item ID
+ # Retrieve catalog_item ID
cfg.catalog_item = cnx.get_catalog_item_by_name(cfg.catalog_id, env[:machine].box.name.to_s)
end
def vcloud_create_catalog(env)
@@ -61,11 +62,11 @@
catalogCreation = cnx.create_catalog(cfg.org_id, cfg.catalog_name, "Created by #{Etc.getlogin} running on #{Socket.gethostname.downcase} using vagrant-vcloud on #{Time.now.strftime("%B %d, %Y")}")
cnx.wait_task_completion(catalogCreation[:task_id])
@logger.debug("Catalog Creation result: #{catalogCreation.inspect}")
- env[:ui].info("Catalog [#{cfg.catalog_name}] created successfully.")
+ env[:ui].info("Catalog [#{cfg.catalog_name}] successfully created.")
cfg.catalog_id = catalogCreation[:catalog_id]
end
@@ -81,29 +82,25 @@
cfg.vdc = cnx.get_vdc_by_name(cfg.org, cfg.vdc_name)
cfg.vdc_id = cnx.get_vdc_id_by_name(cfg.org, cfg.vdc_name)
cfg.catalog = cnx.get_catalog_by_name(cfg.org, cfg.catalog_name)
-
- @logger.debug("BEFORE get_catalog_id_by_name")
cfg.catalog_id = cnx.get_catalog_id_by_name(cfg.org, cfg.catalog_name)
- @logger.debug("AFTER get_catalog_id_by_name: #{cfg.catalog_id}")
-
if cfg.catalog_id.nil?
env[:ui].warn("Catalog [#{cfg.catalog_name}] does not exist!")
user_input = env[:ui].ask(
"Would you like to create the [#{cfg.catalog_name}] catalog?\nChoice (yes/no): "
)
- # FIXME: add an OR clause for just Y
- if user_input.downcase == "yes"
+ if user_input.downcase == "yes" || user_input.downcase == "y"
vcloud_create_catalog(env)
else
env[:ui].error("Catalog not created, exiting...")
+ # FIXME: wrong error message
raise VagrantPlugins::VCloud::Errors::VCloudError,
:message => "Catalog not available, exiting..."
end
end
@@ -116,10 +113,12 @@
# Checking Catalog mandatory requirements
if !cfg.catalog_id
@logger.info("Catalog [#{cfg.catalog_name}] STILL does not exist!")
+
+ # FIXME: wrong error message
raise VagrantPlugins::VCloud::Errors::VCloudError,
:message => "Catalog not available, exiting..."
else
@logger.info("Catalog [#{cfg.catalog_name}] exists")
@@ -131,23 +130,23 @@
user_input = env[:ui].ask(
"Would you like to upload the [#{env[:machine].box.name.to_s}] box to "\
"[#{cfg.catalog_name}] Catalog?\nChoice (yes/no): "
)
- # FIXME: add an OR clause for just Y
- if user_input.downcase == "yes"
+ if user_input.downcase == "yes" || user_input.downcase == "y"
env[:ui].info("Uploading [#{env[:machine].box.name.to_s}]...")
vcloud_upload_box(env)
else
env[:ui].error("Catalog item not available, exiting...")
+ # FIXME: wrong error message
raise VagrantPlugins::VCloud::Errors::VCloudError,
:message => "Catalog item not available, exiting..."
end
else
- #env[:ui].info("Using catalog item [#{env[:machine].box.name.to_s}] in Catalog [#{cfg.catalog_name}]...")
+ @logger.info("Using catalog item [#{env[:machine].box.name.to_s}] in Catalog [#{cfg.catalog_name}]...")
end
end
end
end