Bug 710041 - Condormatic - job_name with slashes
Summary: Condormatic - job_name with slashes
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: CloudForms Cloud Engine
Classification: Retired
Component: aeolus-conductor
Version: 0.3.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: alpha
Assignee: Jan Provaznik
QA Contact: wes hayutin
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2011-06-02 10:30 UTC by Jiri Tomasek
Modified: 2012-01-26 12:19 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Embargoed:


Attachments (Terms of Use)

Description Jiri Tomasek 2011-06-02 10:30:46 UTC
Description of problem:
When launching instance there is a problem with job_name having slashes in method write_pw_file in app/util/condormatic.rb. 

rails.log:

Processing DeploymentsController#create (for ::1 at 2011-06-02 09:58:02) [POST]
  Parameters: {"action"=>"create", "hw_profiles"=>{"6"=>"28"}, "controller"=>"deployments", "deployment"=>{"name"=>"test3", "frontend_realm_id"=>"", "legacy_deployable_id"=>"4", "pool_id"=>"1"}, "launch"=>"Launch"}
cannot generate tempfile `/var/lib/aeolus-conductor/jobs/job_test3/test2_520110602-23948-1ad3ren-9'
/usr/lib/ruby/1.8/tempfile.rb:52:in `initialize'/usr/share/aeolus-conductor/app/util/condormatic.rb:96:in `new'/usr/share/aeolus-conductor/app/util/condormatic.rb:96:in `write_pw_file'/usr/share/aeolus-conductor/app/util/condormatic.rb:124:in `condormatic_instance_create
'/usr/share/aeolus-conductor/app/models/deployment.rb:134:in `launch'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/database_statements.rb:136:in `transaction'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/
transactions.rb:182:in `transaction'/usr/share/aeolus-conductor/app/models/deployment.rb:119:in `launch'/usr/lib/ruby/gems/1.8/gems/will_paginate-2.3.14/lib/will_paginate/finder.rb:168:in `method_missing'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/as
sociations/association_collection.rb:369:in `method_missing_without_paginate'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/associations/association_proxy.rb:215:in `each'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/associations/asso
ciation_proxy.rb:215:in `send'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/associations/association_proxy.rb:215:in `method_missing'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/associations/association_collection.rb:369:in `method_
missing_without_paginate'/usr/lib/ruby/gems/1.8/gems/will_paginate-2.3.14/lib/will_paginate/finder.rb:168:in `method_missing'/usr/share/aeolus-conductor/app/models/deployment.rb:116:in `launch'/usr/share/aeolus-conductor/app/controllers/deployments_controller.rb:55:in `c
reate'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/mime_responds.rb:106:in `call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/mime_responds.rb:106:in `respond_to'/usr/share/aeolus-conductor/app/controllers/deployments_controlle
r.rb:52:in `create'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1331:in `send'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:1331:in `perform_action_without_filters'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib
/action_controller/filters.rb:617:in `call_filters'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in `perform_act
ion_without_rescue'/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms'/usr/lib/ruby/1.8/benchmark.rb:308:in `realtime'/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.8/lib/active_support/core_ext/benchmark.rb:17:in `ms'/usr/l
ib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/rescue.rb:160:in `perform_action_without_flash'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.
8/lib/action_controller/flash.rb:151:in `perform_action'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in `send'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:532:in `process_without_filters'/usr/lib/ruby/gems/1
.8/gems/actionpack-2.3.8/lib/action_controller/filters.rb:606:in `process_without_compass'/usr/lib/ruby/gems/1.8/gems/compass-0.10.4/lib/compass/app_integration/rails/actionpack2/action_controller.rb:7:in `process'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_c
ontroller/base.rb:391:in `process'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/base.rb:386:in `call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/routing/route_set.rb:438:in `call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib
/action_controller/dispatcher.rb:87:in `dispatch'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:121:in `_call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:130:in `build_middleware_stack'/usr/lib/ruby/g
ems/1.8/gems/haml-3.0.18/rails/../lib/sass/plugin/rack.rb:41:in `call'/usr/lib/ruby/gems/1.8/gems/haml-3.0.18/rails/../lib/sass/plugin/rack.rb:41:in `call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/string_coercion.rb:25:in `call'/usr/lib/ruby/gems
/1.8/gems/rack-1.1.0/lib/rack/head.rb:9:in `call'/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/methodoverride.rb:24:in `call'/usr/lib/ruby/gems/1.8/gems/rack-restful_submit-1.1.2/lib/rack/rack-restful_submit.rb:25:in `call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/l
ib/action_controller/params_parser.rb:15:in `call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/session/abstract_store.rb:128:in `call'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:29:in `call'/usr/lib/ruby/gems/1.8/
gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/query_cache.rb:34:in `cache'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:9:in `cache'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/query_cache.rb:28:in `call'/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/connection_adapters/abstract/connection_pool.rb:361:in `call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/failsafe.rb:26:in `call'/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize'/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call'/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.8/lib/action_controller/dispatcher.rb:106:in `call'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/rack/adapter/rails.rb:74:in `call'/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:47:in `call'/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `each'/usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/urlmap.rb:41:in `call'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:76:in `pre_process'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:74:in `catch'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:74:in `pre_process'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:57:in `process'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/connection.rb:42:in `receive_data'/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'/usr/lib/ruby/gems/1.8/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/backends/base.rb:57:in `start'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/server.rb:156:in `start'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/controllers/controller.rb:80:in `start'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:177:in `send'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:177:in `run_command'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/lib/thin/runner.rb:143:in `run!'/usr/lib/ruby/gems/1.8/gems/thin-1.2.5/bin/thin:6/usr/bin/thin:19:in `load'/usr/bin/thin:19
Redirected to https://localhost/conductor/deployments/5


with slashes replaced, it works as expected.

def write_pw_file(job_name, pw)
  # here we write out the password file
  # FIXME: should this be configurable?
  pwdir = '/var/lib/aeolus-conductor/jobs'
  FileUtils.mkdir_p(pwdir, options={:mode => 0700})
  FileUtils.chown('aeolus', 'aeolus', pwdir)

        fname = job_name.gsub(/\//, '_')
  pwfilename = File.join(pwdir, fname)

  tmpfile = Tempfile.new(fname, pwdir)
  tmpfilename = tmpfile.path
  tmpfile.write(pw)
  tmpfile.close

  File.rename(tmpfilename, pwfilename)

  return pwfilename
end

Comment 1 wes hayutin 2011-06-15 12:12:50 UTC
moving bugs to cloud engine project

Comment 2 Jan Provaznik 2011-06-20 08:44:07 UTC
this fixes commit e33a3e90b917b62e11b80d6d5ac23aca486284d9

Comment 3 Mike Orazi 2011-06-21 14:46:16 UTC
Should this be ON_QA?

Comment 4 wes hayutin 2011-06-21 14:53:58 UTC
moving to on_qa

Comment 5 Aziza Karol 2011-07-05 10:11:45 UTC
Slashed replaced.

#vi /usr/share/aeolus-conductor/app/util/condormatic.rb

def write_pw_file(job_name, pw)
  # here we write out the password file
  # FIXME: should this be configurable?
  pwdir = '/var/lib/aeolus-conductor/jobs'
  FileUtils.mkdir_p(pwdir, options={:mode => 0700})
  FileUtils.chown('aeolus', 'aeolus', pwdir)

  # Restrict job names to relatively sane characters only
  job_name.gsub!(/[^a-zA-Z0-9\.\-]/, '_')

  pwfilename = File.join(pwdir, job_name)

  tmpfile = Tempfile.new(job_name, pwdir)
  tmpfilename = tmpfile.path
  tmpfile.write(pw)
  tmpfile.close

  File.rename(tmpfilename, pwfilename)

  return pwfilename
end


[root@dell-pe860-01 lib]# rpm  -qa  | grep aeolus
aeolus-conductor-0.3.0-0.el6.20110701204941gitd66e27c.noarch
aeolus-all-0.3.0-0.el6.20110701204941gitd66e27c.noarch
aeolus-conductor-doc-0.3.0-0.el6.20110701204941gitd66e27c.noarch
aeolus-conductor-daemons-0.3.0-0.el6.20110701204941gitd66e27c.noarch
aeolus-configure-2.0.1-0.el6.20110628141215gitb8aaf85.noarch
rubygem-aeolus-cli-0.0.1-1.el6.20110701204941gitd66e27c.noarc

Comment 6 wes hayutin 2011-07-08 21:00:45 UTC
need a description on how qa might test this w/o just looking at the code.

Comment 7 Jan Provaznik 2011-07-11 06:50:30 UTC
(In reply to comment #6)
> need a description on how qa might test this w/o just looking at the code.

Slash is used when creating an instance name when launching a deployment. Sufficient test is checking if it's possible to launch a deployment - if there is still this bug, deployment launch fail, if you get running instance, it's fixed. There should also be new file in /var/lib/aeolus-conductor/jobs/ with name "job_#{deployment_name}_#{instance_name}_#{number}"

Comment 8 wes hayutin 2011-07-12 13:43:18 UTC
Processing DeploymentsController#create (for 10.11.9.126 at 2011-07-11 19:39:21) [POST]
  Parameters: {"commit"=>"Launch", "action"=>"create", "controller"=>"deployments", "deployment"=>{"name"=>"test02", "frontend_realm_id"=>"2", "deployab
le_xml"=>"<deployable name=\"vmwareWesTest02\">\r\n<description>test01</description>\r\n<assemblies>\r\n<assembly name=\"frontend01\" hwp=\"vmware-mediu
m\">\r\n<image id=\"d2bba849-7af0-4dbd-a53a-44f6f39cc9d7\" build=\"52308cba-7dd6-4cb0-b11c-367d95274134\">\r\n</image>\r\n</assembly>\r\n</assemblies>\r
\n</deployable>\r\n", "pool_id"=>"1"}}
universe = grid
executable = job_test02_frontend01_5
grid_resource = deltacloud http://sgi-xe310-02.rhts.eng.bos.redhat.com:3006/api
DeltacloudUsername = Administrator
DeltacloudPasswordFile = /var/lib/aeolus-conductor/jobs/job_test02_frontend01_5
DeltacloudImageId = factory-image-4d4f8300-0e7d-48e4-9a01-feec8178a6ad
DeltacloudHardwareProfile = large
DeltacloudHardwareProfileMemory = 1024.0
DeltacloudHardwareProfileCPU = 2.0
DeltacloudHardwareProfileStorage = 
DeltacloudKeyname = 
DeltacloudPoolFamily = 1
requirements = true
notification = never
queue
$? (return value?) is 0
Redirected to https://ibm-x3650-05.ovirt.rhts.eng.bos.redhat.com/conductor/deployments/5
Completed in 773ms (DB: 39) | 302 Found [https://ibm-x3650-05.ovirt.rhts.eng.bos.redhat.com/conductor/deployments]


Processing DeploymentsController#show (for 10.11.9.126 at 2011-07-11 19:39:22) [GET]
  Parameters: {"action"=>"show", "id"=>"5", "controller"=>"deployments"}
Rendering template within layouts/application
Rendering deployments/show
:
-- Submitter: ibm-x3650-05.ovirt.rhts.eng.bos.redhat.com : <172.17.95.96:52579> : ibm-x3650-05.ovirt.rhts.eng.bos.redhat.com
 ID      OWNER            SUBMITTED     RUN_TIME ST PRI SIZE CMD               
   1.0   aeolus          7/11 17:24   0+00:00:00 H  0   0.0  job_zdfg_frontend_
   2.0   aeolus          7/11 18:09   0+15:27:25 R  0   0.0  job_vmwareTools01_
   3.0   aeolus          7/11 19:39   0+13:57:11 R  0   0.0  job_test02_fronten

3 jobs; 0 idle, 2 running, 1 held
[root@ibm-x3650-05 32fdc5cdf3f181e7b6987410cf607d15]#

[root@ibm-x3650-05 32fdc5cdf3f181e7b6987410cf607d15]# rpm -qa |grep aeolus
aeolus-all-0.3.0-0.el6.20110711131044git5bc7abf.noarch
aeolus-configure-2.0.1-0.el6.20110708134115gitab1e6dc.noarch
aeolus-conductor-0.3.0-0.el6.20110711131044git5bc7abf.noarch
aeolus-conductor-daemons-0.3.0-0.el6.20110711131044git5bc7abf.noarch
rubygem-aeolus-cli-0.0.1-1.el6.20110711131044git5bc7abf.noarch
aeolus-conductor-doc-0.3.0-0.el6.20110711131044git5bc7abf.noarch
[root@ibm-x3650-05 32fdc5cdf3f181e7b6987410cf607d15]#

Comment 9 wes hayutin 2011-08-01 20:00:26 UTC
release pending...

Comment 10 wes hayutin 2011-08-01 20:00:41 UTC
release pending...

Comment 11 wes hayutin 2011-08-01 20:00:41 UTC
release pending.. 2

Comment 13 wes hayutin 2011-12-08 14:02:03 UTC
closing out old bugs

Comment 14 wes hayutin 2011-12-08 14:14:05 UTC
perm close


Note You need to log in before you can comment on or make changes to this bug.