Skip to content

Commit

Permalink
Clarify user variable name when calling JobQueue#enqueue [#65509840].
Browse files Browse the repository at this point in the history
Signed-off-by: Tyler Schultz <[email protected]>
  • Loading branch information
Christian Williams authored and tylerschultz committed Jan 6, 2015
1 parent d859cdf commit e136569
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ module Api
class CompiledPackageGroupManager
include ApiHelper

def create_from_file_path(user, path)
def create_from_file_path(username, path)
unless File.exists?(path)
raise DirectorError, "Failed to import compiled packages: file not found - #{path}"
end

JobQueue.new.enqueue(user, Jobs::ImportCompiledPackages, 'import compiled packages', [path])
JobQueue.new.enqueue(username, Jobs::ImportCompiledPackages, 'import compiled packages', [path])
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions bosh-director/lib/bosh/director/api/deployment_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def find_by_name(name)
DeploymentLookup.new.by_name(name)
end

def create_deployment(user, deployment_manifest, options = {})
def create_deployment(username, deployment_manifest, options = {})
random_name = "deployment-#{SecureRandom.uuid}"
deployment_manifest_dir = Dir::tmpdir
deployment_manifest_file = File.join(deployment_manifest_dir, random_name)
Expand All @@ -22,11 +22,11 @@ def create_deployment(user, deployment_manifest, options = {})

write_file(deployment_manifest_file, deployment_manifest)

JobQueue.new.enqueue(user, Jobs::UpdateDeployment, 'create deployment', [deployment_manifest_file, options])
JobQueue.new.enqueue(username, Jobs::UpdateDeployment, 'create deployment', [deployment_manifest_file, options])
end

def delete_deployment(user, deployment, options = {})
JobQueue.new.enqueue(user, Jobs::DeleteDeployment, "delete deployment #{deployment.name}", [deployment.name, options])
def delete_deployment(username, deployment, options = {})
JobQueue.new.enqueue(username, Jobs::DeleteDeployment, "delete deployment #{deployment.name}", [deployment.name, options])
end

def deployment_to_json(deployment)
Expand Down
8 changes: 4 additions & 4 deletions bosh-director/lib/bosh/director/api/instance_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,22 @@ def agent_client_for(instance)
AgentClient.with_defaults(vm.agent_id)
end

def fetch_logs(user, deployment_name, job, index, options = {})
def fetch_logs(username, deployment_name, job, index, options = {})
if deployment_name.nil? || job.nil? || index.nil?
raise DirectorError,
'deployment, job and index parameters are required'
end

instance = find_by_name(deployment_name, job, index)

JobQueue.new.enqueue(user, Jobs::FetchLogs, 'fetch logs', [instance.id, options])
JobQueue.new.enqueue(username, Jobs::FetchLogs, 'fetch logs', [instance.id, options])
end

def ssh(user, options)
def ssh(username, options)
description = "ssh: #{options['command']}:#{options['target']}"
deployment = DeploymentLookup.new.by_name(options['deployment_name'])

JobQueue.new.enqueue(user, Jobs::Ssh, description, [deployment.id, options])
JobQueue.new.enqueue(username, Jobs::Ssh, description, [deployment.id, options])
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions bosh-director/lib/bosh/director/api/problem_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ def initialize(deployment_manager = DeploymentManager.new)
@deployment_manager = deployment_manager
end

def perform_scan(user, deployment_name)
def perform_scan(username, deployment_name)
deployment = @deployment_manager.find_by_name(deployment_name)

JobQueue.new.enqueue(user, Jobs::CloudCheck::Scan, 'scan cloud', [deployment.name])
JobQueue.new.enqueue(username, Jobs::CloudCheck::Scan, 'scan cloud', [deployment.name])
end

def get_problems(deployment_name)
Expand All @@ -23,15 +23,15 @@ def get_problems(deployment_name)
Models::DeploymentProblem.filter(filters).order(:created_at).all
end

def apply_resolutions(user, deployment_name, resolutions)
def apply_resolutions(username, deployment_name, resolutions)
deployment = @deployment_manager.find_by_name(deployment_name)
JobQueue.new.enqueue(user, Jobs::CloudCheck::ApplyResolutions, 'apply resolutions', [deployment.name, resolutions])
JobQueue.new.enqueue(username, Jobs::CloudCheck::ApplyResolutions, 'apply resolutions', [deployment.name, resolutions])
end

def scan_and_fix(user, deployment_name, jobs)
def scan_and_fix(username, deployment_name, jobs)
deployment = @deployment_manager.find_by_name(deployment_name)

JobQueue.new.enqueue(user, Jobs::CloudCheck::ScanAndFix, 'scan and fix', [deployment.name, jobs, Bosh::Director::Config.fix_stateful_nodes])
JobQueue.new.enqueue(username, Jobs::CloudCheck::ScanAndFix, 'scan and fix', [deployment.name, jobs, Bosh::Director::Config.fix_stateful_nodes])
end
end
end
Expand Down
12 changes: 6 additions & 6 deletions bosh-director/lib/bosh/director/api/release_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,21 @@ def find_version(release, version)
release_version
end

def create_release_from_url(user, release_url, options)
def create_release_from_url(username, release_url, options)
options[:remote] = true
JobQueue.new.enqueue(user, Jobs::UpdateRelease, 'create release', [release_url, options])
JobQueue.new.enqueue(username, Jobs::UpdateRelease, 'create release', [release_url, options])
end

def create_release_from_file_path(user, release_path, options)
def create_release_from_file_path(username, release_path, options)
unless File.exists?(release_path)
raise DirectorError, "Failed to create release: file not found - #{release_path}"
end

JobQueue.new.enqueue(user, Jobs::UpdateRelease, 'create release', [release_path, options])
JobQueue.new.enqueue(username, Jobs::UpdateRelease, 'create release', [release_path, options])
end

def delete_release(user, release, options = {})
JobQueue.new.enqueue(user, Jobs::DeleteRelease, "delete release: #{release.name}", [release.name, options])
def delete_release(username, release, options = {})
JobQueue.new.enqueue(username, Jobs::DeleteRelease, "delete release: #{release.name}", [release.name, options])
end
end
end
Expand Down
16 changes: 8 additions & 8 deletions bosh-director/lib/bosh/director/api/snapshot_manager.rb
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
module Bosh::Director
module Api
class SnapshotManager
def create_deployment_snapshot_task(user, deployment, options = {})
JobQueue.new.enqueue(user, Jobs::SnapshotDeployment, 'snapshot deployment', [deployment.name, options])
def create_deployment_snapshot_task(username, deployment, options = {})
JobQueue.new.enqueue(username, Jobs::SnapshotDeployment, 'snapshot deployment', [deployment.name, options])
end

def create_snapshot_task(user, instance, options)
JobQueue.new.enqueue(user, Jobs::CreateSnapshot, 'create snapshot', [instance.id, options])
def create_snapshot_task(username, instance, options)
JobQueue.new.enqueue(username, Jobs::CreateSnapshot, 'create snapshot', [instance.id, options])
end

def delete_deployment_snapshots_task(user, deployment)
JobQueue.new.enqueue(user, Jobs::DeleteDeploymentSnapshots, 'delete deployment snapshots', [deployment.name])
def delete_deployment_snapshots_task(username, deployment)
JobQueue.new.enqueue(username, Jobs::DeleteDeploymentSnapshots, 'delete deployment snapshots', [deployment.name])
end

def delete_snapshots_task(user, snapshot_cids)
JobQueue.new.enqueue(user, Jobs::DeleteSnapshots, 'delete snapshot', [snapshot_cids])
def delete_snapshots_task(username, snapshot_cids)
JobQueue.new.enqueue(username, Jobs::DeleteSnapshots, 'delete snapshot', [snapshot_cids])
end

def find_by_cid(deployment, snapshot_cid)
Expand Down
12 changes: 6 additions & 6 deletions bosh-director/lib/bosh/director/api/stemcell_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ def stemcell_exists?(name, version)
false
end

def create_stemcell_from_url(user, stemcell_url)
JobQueue.new.enqueue(user, Jobs::UpdateStemcell, 'create stemcell', [stemcell_url, { remote: true }])
def create_stemcell_from_url(username, stemcell_url)
JobQueue.new.enqueue(username, Jobs::UpdateStemcell, 'create stemcell', [stemcell_url, { remote: true }])
end

def create_stemcell_from_file_path(user, stemcell_path)
def create_stemcell_from_file_path(username, stemcell_path)
unless File.exists?(stemcell_path)
raise DirectorError, "Failed to create stemcell: file not found - #{stemcell_path}"
end

JobQueue.new.enqueue(user, Jobs::UpdateStemcell, 'create stemcell', [stemcell_path])
JobQueue.new.enqueue(username, Jobs::UpdateStemcell, 'create stemcell', [stemcell_path])
end

def delete_stemcell(user, stemcell, options={})
def delete_stemcell(username, stemcell, options={})
description = "delete stemcell: #{stemcell.name}/#{stemcell.version}"

JobQueue.new.enqueue(user, Jobs::DeleteStemcell, description, [stemcell.name, stemcell.version, options])
JobQueue.new.enqueue(username, Jobs::DeleteStemcell, description, [stemcell.name, stemcell.version, options])
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions bosh-director/lib/bosh/director/api/vm_state_manager.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Bosh::Director
module Api
class VmStateManager
def fetch_vm_state(user, deployment, format)
JobQueue.new.enqueue(user, Jobs::VmState, 'retrieve vm-stats', [deployment.id, format])
def fetch_vm_state(username, deployment, format)
JobQueue.new.enqueue(username, Jobs::VmState, 'retrieve vm-stats', [deployment.id, format])
end
end
end
Expand Down

0 comments on commit e136569

Please sign in to comment.