def SshKeys(self, ssh_keys: List[Structure]):
        """Set a list of DBus structures, each corresponding to a single SSH key.

        :param ssh_keys: a list of SSH key describing DBus structures
        """
        self.implementation.set_ssh_keys(
            SshKeyData.from_structure_list(ssh_keys))
Beispiel #2
0
    def process_kickstart(self, data):
        """Process the kickstart data."""
        log.debug("Processing kickstart data...")

        self.set_root_password(data.rootpw.password,
                               crypted=data.rootpw.isCrypted)
        self.set_root_account_locked(data.rootpw.lock)
        # make sure the root account is locked unless a password is set in kickstart
        if not data.rootpw.password:
            log.debug(
                "root specified in kickstart without password, locking account"
            )
            self.set_root_account_locked(True)
        # if password was set in kickstart it can't be changed by default
        if data.rootpw.seen:
            self.set_can_change_root_password(False)
            self._rootpw_seen = True

        user_data_list = []
        for user_ksdata in data.user.userList:
            user_data_list.append(self._ksdata_to_user_data(user_ksdata))
        self.set_users(user_data_list)

        group_data_list = []
        for group_ksdata in data.group.groupList:
            group_data = GroupData()
            group_data.name = group_ksdata.name
            if group_ksdata.gid is not None:
                group_data.gid = group_ksdata.gid
            group_data_list.append(group_data)
        self.set_groups(group_data_list)

        ssh_key_data_list = []
        for ssh_key_ksdata in data.sshkey.sshUserList:
            ssh_key_data = SshKeyData()
            ssh_key_data.key = ssh_key_ksdata.key
            ssh_key_data.username = ssh_key_ksdata.username
            ssh_key_data_list.append(ssh_key_data)
        self.set_ssh_keys(ssh_key_data_list)
Beispiel #3
0
    def SshKeys(self) -> List[Structure]:
        """List of SSH keys, each describing a single SSH key.

        :return: a list of SSH key describing DBus Structures
        """
        # internally we hold the data about SSH keys as a list of structures,
        # which we need to turn into a list of dicts before returning it
        # over DBus
        ssh_key_dicts = []

        for ssh_key_data in self.implementation.ssh_keys:
            ssh_key_dicts.append(SshKeyData.to_structure(ssh_key_data))
        return ssh_key_dicts
    def SshKeys(self) -> List[Structure]:
        """List of SSH keys, each describing a single SSH key.

        :return: a list of SSH key describing DBus Structures
        """
        return SshKeyData.to_structure_list(self.implementation.ssh_keys)