mirror of
https://github.com/portainer/portainer.git
synced 2025-08-02 20:35:25 +02:00
Merge branch 'develop' into oath-poc
This commit is contained in:
commit
508352f4ea
53 changed files with 626 additions and 452 deletions
|
@ -139,6 +139,7 @@ func (store *Store) MigrateData() error {
|
|||
DatabaseVersion: version,
|
||||
EndpointGroupService: store.EndpointGroupService,
|
||||
EndpointService: store.EndpointService,
|
||||
ExtensionService: store.ExtensionService,
|
||||
ResourceControlService: store.ResourceControlService,
|
||||
SettingsService: store.SettingsService,
|
||||
StackService: store.StackService,
|
||||
|
|
19
api/bolt/migrator/migrate_dbversion16.go
Normal file
19
api/bolt/migrator/migrate_dbversion16.go
Normal file
|
@ -0,0 +1,19 @@
|
|||
package migrator
|
||||
|
||||
func (m *Migrator) updateExtensionsToDBVersion17() error {
|
||||
legacyExtensions, err := m.extensionService.Extensions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, extension := range legacyExtensions {
|
||||
extension.License.Valid = true
|
||||
|
||||
err = m.extensionService.Persist(&extension)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
|
@ -5,6 +5,7 @@ import (
|
|||
"github.com/portainer/portainer"
|
||||
"github.com/portainer/portainer/bolt/endpoint"
|
||||
"github.com/portainer/portainer/bolt/endpointgroup"
|
||||
"github.com/portainer/portainer/bolt/extension"
|
||||
"github.com/portainer/portainer/bolt/resourcecontrol"
|
||||
"github.com/portainer/portainer/bolt/settings"
|
||||
"github.com/portainer/portainer/bolt/stack"
|
||||
|
@ -20,6 +21,7 @@ type (
|
|||
db *bolt.DB
|
||||
endpointGroupService *endpointgroup.Service
|
||||
endpointService *endpoint.Service
|
||||
extensionService *extension.Service
|
||||
resourceControlService *resourcecontrol.Service
|
||||
settingsService *settings.Service
|
||||
stackService *stack.Service
|
||||
|
@ -35,6 +37,7 @@ type (
|
|||
DatabaseVersion int
|
||||
EndpointGroupService *endpointgroup.Service
|
||||
EndpointService *endpoint.Service
|
||||
ExtensionService *extension.Service
|
||||
ResourceControlService *resourcecontrol.Service
|
||||
SettingsService *settings.Service
|
||||
StackService *stack.Service
|
||||
|
@ -52,6 +55,7 @@ func NewMigrator(parameters *Parameters) *Migrator {
|
|||
currentDBVersion: parameters.DatabaseVersion,
|
||||
endpointGroupService: parameters.EndpointGroupService,
|
||||
endpointService: parameters.EndpointService,
|
||||
extensionService: parameters.ExtensionService,
|
||||
resourceControlService: parameters.ResourceControlService,
|
||||
settingsService: parameters.SettingsService,
|
||||
templateService: parameters.TemplateService,
|
||||
|
@ -210,5 +214,13 @@ func (m *Migrator) Migrate() error {
|
|||
}
|
||||
}
|
||||
|
||||
// Portainer 1.20.1
|
||||
if m.currentDBVersion < 17 {
|
||||
err := m.updateExtensionsToDBVersion17()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return m.versionService.StoreDBVersion(portainer.DBVersion)
|
||||
}
|
||||
|
|
|
@ -492,7 +492,10 @@ func initExtensionManager(fileService portainer.FileService, extensionService po
|
|||
for _, extension := range extensions {
|
||||
err := extensionManager.EnableExtension(&extension, extension.License.LicenseKey)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
log.Printf("Unable to enable extension: %s [extension: %s]", err.Error(), extension.Name)
|
||||
extension.Enabled = false
|
||||
extension.License.Valid = false
|
||||
extensionService.Persist(&extension)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -113,6 +113,7 @@ func (manager *ExtensionManager) EnableExtension(extension *portainer.Extension,
|
|||
LicenseKey: licenseKey,
|
||||
Company: licenseDetails[0],
|
||||
Expiration: licenseDetails[1],
|
||||
Valid: true,
|
||||
}
|
||||
extension.Version = licenseDetails[2]
|
||||
|
||||
|
|
|
@ -42,7 +42,7 @@ func (handler *Handler) extensionCreate(w http.ResponseWriter, r *http.Request)
|
|||
}
|
||||
|
||||
for _, existingExtension := range extensions {
|
||||
if existingExtension.ID == extensionID {
|
||||
if existingExtension.ID == extensionID && existingExtension.Enabled {
|
||||
return &httperror.HandlerError{http.StatusConflict, "Unable to enable extension", portainer.ErrExtensionAlreadyEnabled}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ func associateExtensionData(definition *portainer.Extension, extensions []portai
|
|||
definition.Enabled = extension.Enabled
|
||||
definition.License.Company = extension.License.Company
|
||||
definition.License.Expiration = extension.License.Expiration
|
||||
definition.License.Valid = extension.License.Valid
|
||||
|
||||
definitionVersion := semver.New(definition.Version)
|
||||
extensionVersion := semver.New(extension.Version)
|
||||
|
|
|
@ -67,7 +67,12 @@ func (handler *Handler) settingsUpdate(w http.ResponseWriter, r *http.Request) *
|
|||
}
|
||||
|
||||
if payload.LDAPSettings != nil {
|
||||
ldapPassword := settings.LDAPSettings.Password
|
||||
if payload.LDAPSettings.Password != "" {
|
||||
ldapPassword = payload.LDAPSettings.Password
|
||||
}
|
||||
settings.LDAPSettings = *payload.LDAPSettings
|
||||
settings.LDAPSettings.Password = ldapPassword
|
||||
}
|
||||
|
||||
if payload.OAuthSettings != nil {
|
||||
|
|
|
@ -517,6 +517,7 @@ type (
|
|||
LicenseKey string `json:"LicenseKey,omitempty"`
|
||||
Company string `json:"Company,omitempty"`
|
||||
Expiration string `json:"Expiration,omitempty"`
|
||||
Valid bool `json:"Valid,omitempty"`
|
||||
}
|
||||
|
||||
// CLIService represents a service for managing CLI
|
||||
|
@ -799,9 +800,9 @@ type (
|
|||
|
||||
const (
|
||||
// APIVersion is the version number of the Portainer API
|
||||
APIVersion = "1.20.0"
|
||||
APIVersion = "1.20.1"
|
||||
// DBVersion is the version number of the Portainer database
|
||||
DBVersion = 16
|
||||
DBVersion = 17
|
||||
// AssetsServerURL represents the URL of the Portainer asset server
|
||||
AssetsServerURL = "https://portainer-io-assets.sfo2.digitaloceanspaces.com"
|
||||
// MessageOfTheDayURL represents the URL where Portainer MOTD message can be retrieved
|
||||
|
|
|
@ -54,7 +54,7 @@ info:
|
|||
|
||||
**NOTE**: You can find more information on how to query the Docker API in the [Docker official documentation](https://docs.docker.com/engine/api/v1.30/) as well as in [this Portainer example](https://gist.github.com/deviantony/77026d402366b4b43fa5918d41bc42f8).
|
||||
|
||||
version: "1.20.0"
|
||||
version: "1.20.1"
|
||||
title: "Portainer API"
|
||||
contact:
|
||||
email: "info@portainer.io"
|
||||
|
@ -525,7 +525,7 @@ paths:
|
|||
**Access policy**: administrator
|
||||
operationId: "EndpointJob"
|
||||
consumes:
|
||||
- "application/json"
|
||||
- "multipart/form-data"
|
||||
produces:
|
||||
- "application/json"
|
||||
security:
|
||||
|
@ -1434,7 +1434,7 @@ paths:
|
|||
**Access policy**: restricted
|
||||
operationId: "StackCreate"
|
||||
consumes:
|
||||
- "application/json"
|
||||
- "multipart/form-data"
|
||||
produces:
|
||||
- "application/json"
|
||||
security:
|
||||
|
@ -2733,7 +2733,7 @@ paths:
|
|||
- "application/json"
|
||||
security:
|
||||
- jwt: []
|
||||
parameters:
|
||||
parameters: []
|
||||
responses:
|
||||
200:
|
||||
description: "Success"
|
||||
|
@ -3018,7 +3018,7 @@ definitions:
|
|||
description: "Is analytics enabled"
|
||||
Version:
|
||||
type: "string"
|
||||
example: "1.20.0"
|
||||
example: "1.20.1"
|
||||
description: "Portainer API version"
|
||||
PublicSettingsInspectResponse:
|
||||
type: "object"
|
||||
|
@ -3146,7 +3146,7 @@ definitions:
|
|||
$ref: "#/definitions/LDAPGroupSearchSettings"
|
||||
AutoCreateUsers:
|
||||
type: "boolean"
|
||||
example: "true"
|
||||
example: true
|
||||
description: "Automatically provision users and assign them to matching LDAP group names"
|
||||
|
||||
Settings:
|
||||
|
@ -3606,6 +3606,7 @@ definitions:
|
|||
- "Authentication"
|
||||
- "Name"
|
||||
- "Password"
|
||||
- "Type"
|
||||
- "URL"
|
||||
- "Username"
|
||||
properties:
|
||||
|
@ -3613,6 +3614,10 @@ definitions:
|
|||
type: "string"
|
||||
example: "my-registry"
|
||||
description: "Name that will be used to identify this registry"
|
||||
Type:
|
||||
type: "integer"
|
||||
example: 1
|
||||
description: "Registry Type. Valid values are: 1 (Quay.io), 2 (Azure container registry) or 3 (custom registry)"
|
||||
URL:
|
||||
type: "string"
|
||||
example: "registry.mydomain.tld:2375"
|
||||
|
@ -4037,7 +4042,7 @@ definitions:
|
|||
description: "A list of categories associated to the template"
|
||||
items:
|
||||
type: "string"
|
||||
exampe: "database"
|
||||
example: "database"
|
||||
registry:
|
||||
type: "string"
|
||||
example: "quay.io"
|
||||
|
@ -4133,7 +4138,7 @@ definitions:
|
|||
description: "A list of categories associated to the template"
|
||||
items:
|
||||
type: "string"
|
||||
exampe: "database"
|
||||
example: "database"
|
||||
registry:
|
||||
type: "string"
|
||||
example: "quay.io"
|
||||
|
@ -4233,7 +4238,7 @@ definitions:
|
|||
description: "A list of categories associated to the template"
|
||||
items:
|
||||
type: "string"
|
||||
exampe: "database"
|
||||
example: "database"
|
||||
registry:
|
||||
type: "string"
|
||||
example: "quay.io"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"packageName": "portainer",
|
||||
"packageVersion": "1.20.0",
|
||||
"packageVersion": "1.20.1",
|
||||
"projectName": "portainer"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue