Beispiel #1
0
 def create_storage(self):
     new_storage = self.prepare_storage_args()
     try:
         pvesh.create("storage", storage=self.name, **new_storage)
         return None
     except ProxmoxShellError as e:
         return e.message
    def create_role(self):
        new_role = self.prepare_role_args()

        try:
            pvesh.create("access/roles", **new_role)
            return (True, None)
        except ProxmoxShellError as e:
            return (False, e.message)
    def create_group(self):
        new_group = {}
        if self.comment is not None:
            new_group['comment'] = self.comment

        try:
            pvesh.create("access/groups", groupid=self.name, **new_group)
            return (True, None)
        except ProxmoxShellError as e:
            return (False, e.message)
Beispiel #4
0
    def create_user(self):
        new_user = self.prepare_user_args()

        if self.password is not None:
            new_user['password'] = self.password

        if not self.check_groups_exist():
            return (False, "One or more specified groups do not exist.")

        try:
            pvesh.create("access/users", userid=self.name, **new_user)
            return (True, None)
        except ProxmoxShellError as e:
            return (False, e.message)