Skip to content

Commit ebd9b5f

Browse files
dguidoclaude
andcommitted
Add permission check for local deployment update-users
For local deployments, file ownership must be consistent between initial deployment and subsequent update-users runs. When there's a mismatch (e.g., initial deployment without sudo, update with sudo), files get mixed ownership causing permission errors. This adds a pre-flight check that: - Detects local deployments (localhost or algo_provider: local) - Compares config directory owner with current user - Displays a warning with guidance if there's a mismatch - Provides the exact chown command to fix permissions Addresses #14551 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent a79c9ce commit ebd9b5f

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

users.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,35 @@
5151
include_vars:
5252
file: configs/{{ algo_server }}/.config.yml
5353

54+
- name: Check local deployment permissions
55+
block:
56+
- name: Get config directory owner
57+
stat:
58+
path: configs/{{ algo_server }}
59+
register: config_dir_stat
60+
61+
- name: Warn about local deployment permissions
62+
debug:
63+
msg: |
64+
LOCAL DEPLOYMENT DETECTED
65+
66+
For local deployments, file permissions must be consistent.
67+
Config directory is owned by: {{ config_dir_stat.stat.pw_name }}
68+
Current user: {{ ansible_user_id }}
69+
Running as root: {{ ansible_user_id == 'root' }}
70+
71+
To avoid permission issues:
72+
- Always run update-users the same way as initial deployment
73+
- If you used sudo initially, use sudo for updates
74+
- If you didn't use sudo initially, don't use it for updates
75+
76+
If permissions are already mixed, fix with:
77+
sudo chown -R {{ config_dir_stat.stat.pw_name }} configs/{{ algo_server }}/
78+
when: >
79+
(ansible_user_id == 'root' and config_dir_stat.stat.pw_name != 'root') or
80+
(ansible_user_id != 'root' and config_dir_stat.stat.pw_name == 'root')
81+
when: algo_server == 'localhost' or algo_provider | default('') == 'local'
82+
5483
- name: Test SSH connectivity to server
5584
wait_for:
5685
host: "{{ algo_server }}"

0 commit comments

Comments
 (0)