Skip to content

Commit 762dfd0

Browse files
committed
Address PR feedback
1 parent 3fd097b commit 762dfd0

File tree

8 files changed

+15
-15
lines changed

8 files changed

+15
-15
lines changed

app/models/runtime/app_model.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module VCAP::CloudController
77
class AppModel < Sequel::Model(:apps)
88
include Serializer
99
APP_NAME_REGEX = /\A[[:alnum:][:punct:][:print:]]+\Z/
10-
DEFAULT_USER = 'vcap'.freeze
10+
DEFAULT_CONTAINER_USER = 'vcap'.freeze
1111

1212
many_to_many :routes, join_table: :route_mappings, left_key: :app_guid, left_primary_key: :guid, right_primary_key: :guid, right_key: :route_guid
1313
one_to_many :route_mappings, class: 'VCAP::CloudController::RouteMappingModel', key: :app_guid, primary_key: :guid

app/models/runtime/process_model.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def started_command
395395
def run_action_user
396396
return user if user.present?
397397

398-
docker? ? docker_run_action_user : AppModel::DEFAULT_USER
398+
docker? ? docker_run_action_user : AppModel::DEFAULT_CONTAINER_USER
399399
end
400400

401401
def specified_or_detected_command
@@ -572,11 +572,11 @@ def open_ports
572572
private
573573

574574
def permitted_users
575-
Set.new([AppModel::DEFAULT_USER]) + Config.config.get(:additional_allowed_process_users)
575+
Set.new([AppModel::DEFAULT_CONTAINER_USER]) + Config.config.get(:additional_allowed_process_users)
576576
end
577577

578578
def docker_run_action_user
579-
desired_droplet.docker_user.presence || AppModel::DEFAULT_USER
579+
desired_droplet.docker_user.presence || AppModel::DEFAULT_CONTAINER_USER
580580
end
581581

582582
def non_unique_process_types

app/models/runtime/task_model.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ def after_destroy
4747
def run_action_user
4848
return user if user.present?
4949

50-
docker? ? docker_run_action_user : AppModel::DEFAULT_USER
50+
docker? ? docker_run_action_user : AppModel::DEFAULT_CONTAINER_USER
5151
end
5252

5353
delegate :docker?, to: :droplet
5454

5555
private
5656

5757
def permitted_users
58-
Set.new([AppModel::DEFAULT_USER]) + Config.config.get(:additional_allowed_process_users)
58+
Set.new([AppModel::DEFAULT_CONTAINER_USER]) + Config.config.get(:additional_allowed_process_users)
5959
end
6060

6161
def docker_run_action_user
62-
droplet.docker_user.presence || AppModel::DEFAULT_USER
62+
droplet.docker_user.presence || AppModel::DEFAULT_CONTAINER_USER
6363
end
6464

6565
def running_state?

docs/v3/source/includes/resources/tasks/_create.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Name | Type | Description
4949
| Name | Type | Description | Default |
5050
|---------------------------------------------|-------------------------------------|--------------------------------------------------------------|----------------------------------------------------------------------|
5151
| **name** | _string_ | Name of the task | auto-generated |
52-
| **user** | _string_ | User used to run the task | "vcap" |
52+
| **user** | _string_ | OS user used to run the task in the runtime | "vcap" |
5353
| **disk_in_mb**<sup>[1]</sup> | _integer_ | Amount of disk to allocate for the task in MB | operator-configured `default_app_disk_in_mb` |
5454
| **memory_in_mb**<sup>[1]</sup> | _integer_ | Amount of memory to allocate for the task in MB | operator-configured `default_app_memory` |
5555
| **log_rate_limit_per_second**<sup>[1]</sup> | _integer_ | Amount of log rate to allocate for the task in bytes | operator-configured `default_app_log_rate_limit_in_bytes_per_second` |

docs/v3/source/includes/resources/tasks/_object.md.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Name | Type | Description
1515
**sequence_id** | _integer_ | User-facing id of the task; this number is unique for every task associated with a given app
1616
**name** | _string_ | Name of the task
1717
**command** | _string_ | Command that will be executed; this field may be excluded based on a user's role
18-
**user** | _string_ or _null_ | The user used to run the task
18+
**user** | _string_ or _null_ | The OS user used to run the task in the runtime
1919
**state** | _string_ | State of the task Possible states are `PENDING`, `RUNNING`, `SUCCEEDED`, `CANCELING`, and `FAILED`
2020
**memory_in_mb** | _integer_ | Amount of memory to allocate for the task in MB
2121
**disk_in_mb** | _integer_ | Amount of disk to allocate for the task in MB

spec/unit/models/runtime/droplet_model_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ module VCAP::CloudController
356356
end
357357

358358
context 'when the droplet belongs to a Docker lifecycle app' do
359-
let(:droplet_execution_metadata) { '{"entrypoint":["/cnb/lifecycle/launcher"],"user":"cnb"}' }
359+
let(:droplet_execution_metadata) { '{"entrypoint":["/image-entrypoint.sh"],"user":"cnb"}' }
360360
let(:droplet_model) { DropletModel.make(:docker, execution_metadata: droplet_execution_metadata) }
361361

362362
context 'when the droplet execution metadata specifies a user' do
@@ -366,7 +366,7 @@ module VCAP::CloudController
366366
end
367367

368368
context 'when the droplet execution metadata DOES NOT specify a user' do
369-
let(:droplet_execution_metadata) { '{"entrypoint":["/cnb/lifecycle/launcher"]}' }
369+
let(:droplet_execution_metadata) { '{"entrypoint":["/image-entrypoint.sh"]}' }
370370

371371
it 'defaults the user to root' do
372372
expect(droplet_model.docker_user).to eq('root')

spec/unit/models/runtime/process_model_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ def act_as_cf_admin
679679

680680
context 'when the process belongs to a Docker lifecycle app' do
681681
subject(:process) { ProcessModelFactory.make({ docker_image: 'example.com/image' }) }
682-
let(:droplet_execution_metadata) { '{"entrypoint":["/cnb/lifecycle/launcher"],"user":"cnb"}' }
682+
let(:droplet_execution_metadata) { '{"entrypoint":["/image-entrypoint.sh"],"user":"cnb"}' }
683683

684684
before do
685685
process.desired_droplet.update(execution_metadata: droplet_execution_metadata)
@@ -704,7 +704,7 @@ def act_as_cf_admin
704704
end
705705

706706
context 'when the droplet execution metadata DOES NOT specify a user' do
707-
let(:droplet_execution_metadata) { '{"entrypoint":["/cnb/lifecycle/launcher"]}' }
707+
let(:droplet_execution_metadata) { '{"entrypoint":["/image-entrypoint.sh"]}' }
708708

709709
it 'defaults the user to root' do
710710
expect(process.run_action_user).to eq('root')

spec/unit/models/runtime/task_model_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ module VCAP::CloudController
172172
let(:parent_app) { AppModel.make(:docker) }
173173
let(:task) { TaskModel.make(app: parent_app, droplet: droplet, state: TaskModel::SUCCEEDED_STATE) }
174174
let(:droplet) { DropletModel.make(:docker) }
175-
let(:droplet_execution_metadata) { '{"entrypoint":["/cnb/lifecycle/launcher"],"user":"cnb"}' }
175+
let(:droplet_execution_metadata) { '{"entrypoint":["/image-entrypoint.sh"],"user":"cnb"}' }
176176

177177
before do
178178
task.droplet.update(execution_metadata: droplet_execution_metadata)
@@ -195,7 +195,7 @@ module VCAP::CloudController
195195
end
196196

197197
context 'when the droplet execution metadata DOES NOT specify a user' do
198-
let(:droplet_execution_metadata) { '{"entrypoint":["/cnb/lifecycle/launcher"]}' }
198+
let(:droplet_execution_metadata) { '{"entrypoint":["/image-entrypoint.sh"]}' }
199199

200200
it 'defaults the user to root' do
201201
expect(task.run_action_user).to eq('root')

0 commit comments

Comments
 (0)