@@ -1396,7 +1396,7 @@ def disk_create(
13961396 if creating a disk without an image.
13971397 :param read_only: If True, creates a read-only disk
13981398 :param image: The Image to deploy to the disk. If provided, at least one of
1399- root_pass or authorized_keys must also be given.
1399+ root_pass, authorized_users or authorized_keys must also be given.
14001400 :param root_pass: The password to configure for the root user when deploying an
14011401 image to this disk. Not used if image is not given. If an
14021402 image is given and root_pass is provided, it will be returned
@@ -1419,10 +1419,10 @@ def disk_create(
14191419 :rtype: Disk or tuple(Disk, str)
14201420 """
14211421
1422- if image and not root_pass and not authorized_keys :
1422+ if image and not root_pass and not authorized_keys and not authorized_users :
14231423 raise ValueError (
14241424 "When creating a Disk from an Image, at least one of "
1425- "root_pass or authorized_keys must be provided."
1425+ "root_pass, authorized_users, or authorized_keys must be provided."
14261426 )
14271427
14281428 authorized_keys = load_and_validate_keys (authorized_keys )
@@ -1586,6 +1586,7 @@ def rebuild(
15861586 disk_encryption : Optional [
15871587 Union [InstanceDiskEncryptionType , str ]
15881588 ] = None ,
1589+ authorized_users : Optional [List [str ]] = None ,
15891590 ** kwargs ,
15901591 ):
15911592 """
@@ -1598,24 +1599,29 @@ def rebuild(
15981599 :param image: The Image to deploy to this Instance
15991600 :type image: str or Image
16001601 :param root_pass: The root password for the newly rebuilt Instance. At least
1601- one of root_pass or authorized_keys must be provided.
1602+ one of root_pass, authorized_users, or authorized_keys must be provided.
16021603 :type root_pass: str
16031604 :param authorized_keys: The ssh public keys to install in the linode's
16041605 /root/.ssh/authorized_keys file. Each entry may
16051606 be a single key, or a path to a file containing
16061607 the key.
16071608 :type authorized_keys: list or str
1609+ :param authorized_users: A list of usernames whose keys should be installed
1610+ as trusted for the root user. These user's keys
1611+ should already be set up, see :any:`ProfileGroup.ssh_keys`
1612+ for details.
1613+ :type authorized_users: list[str]
16081614 :param disk_encryption: The disk encryption policy for this Linode.
16091615 NOTE: Disk encryption may not currently be available to all users.
16101616 :type disk_encryption: InstanceDiskEncryptionType or str
16111617
16121618 :returns: The root_pass if provided, otherwise True.
16131619 :rtype: str or bool
16141620 """
1615- if not root_pass and not authorized_keys :
1621+ if not root_pass and not authorized_keys and not authorized_users :
16161622 raise ValueError (
16171623 "When rebuilding an Instance, at least one of "
1618- "root_pass or authorized_keys must be provided."
1624+ "root_pass, authorized_users, or authorized_keys must be provided."
16191625 )
16201626
16211627 authorized_keys = load_and_validate_keys (authorized_keys )
@@ -1627,6 +1633,7 @@ def rebuild(
16271633 "disk_encryption" : (
16281634 str (disk_encryption ) if disk_encryption else None
16291635 ),
1636+ "authorized_users" : authorized_users ,
16301637 }
16311638
16321639 params .update (kwargs )
0 commit comments