Skip to content

Commit

Permalink
Remove 'use_machine_owner_for_console_user' tag used for rollouts
Browse files Browse the repository at this point in the history
Summary:
```
```

the tag was used to rollout the change to a core library.   It's been at 100% for 4+ months

Differential Revision: D51140315

fbshipit-source-id: f6b6da3b12107e2642b90087916db3d36ec1d8d0
  • Loading branch information
Greg Batye authored and facebook-github-bot committed Nov 13, 2023
1 parent 9e870d5 commit 120ec5a
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions itchef/cookbooks/cpe_helpers/libraries/cpe_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,25 +157,13 @@ def self.console_user
@console_user ||=
if macos?
user = get_macos_console_user.to_s

# tag file to rollout new logic to use machine_owner
# for local account chef runs
rollout_tag = ::File.join(
CPE::Utils.get_cpe_path('tags'),
'.use_machine_owner_for_local_accounts',
)
if ::File.exist?(rollout_tag)
if macos_local_account?(user)
CPE::Log.log(
"#{user} detected as console user, " +
"falling back to machine owner: #{machine_owner}",
:type => 'cpe::helpers.console_user',
:action => 'read_from_machine_owner_macos',
)
user = machine_owner
end
# use machine_owner if console user is a local account
# prevents running chef as "root" user
if macos_local_account?(user)
machine_owner
else
user
end
user
elsif linux?
filtered_users = loginctl_users.select do |u|
u['user'] != 'gdm' && u['uid'] >= 1000
Expand Down

0 comments on commit 120ec5a

Please sign in to comment.