user_add silently ignores numeric uid
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Fix Released
|
High
|
Unassigned |
Bug Description
Given content of 'user-data' such as
```
users:
- default
- name: eric
uid: 1742
- name: archivist
uid: '1724'
```
the created account as listed in '/etc/passwd' are
```
eric:x:
archivist:
ubuntu:
```
Notice that account 'eric' has `uid=1000` even though the 'user-data' config specifies `uid: 1742`. No error, warning or other obvious message appears in 'cloud-init.log'.
The relevant source code appears to begin around [line 458 of cloudinit/
The ubuntu image where this occurs is `ubuntu-
A moderately helpful fix is to add error reporting to the conditional when `isinstance(val, str)` fails. A more user-friendly fix is to simply convert `val` to a string.
Thanks for filing the bug.