Skip to content

Commit

Permalink
fix: [#381] 405 not allowed when creating repositories as 'https' cou…
Browse files Browse the repository at this point in the history
…ld not be enabled.
  • Loading branch information
030 committed Oct 14, 2023
1 parent f77c065 commit b01abfd
Show file tree
Hide file tree
Showing 27 changed files with 341 additions and 177 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
[godoc]: https://godoc.org/github.com/030/n3dr
[godoc widget]: https://godoc.org/github.com/030/n3dr?status.svg

[![dockeri.co](https://dockeri.co/image/utrecht/n3dr)](https://hub.docker.com/r/utrecht/n3dr)

## Backup or Migrate an entire Nexus Artifact Server

Download all artifacts at once or migrate automatically from Nexus to Nexus.
Expand Down
2 changes: 1 addition & 1 deletion build/package/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: n3dr
base: core20
version: 7.2.5
version: 7.3.1
summary: Nexus3 Disaster Recovery
description: |
Download all artifacts at once or migrate automatically from Nexus to Nexus.
Expand Down
11 changes: 6 additions & 5 deletions cmd/n3dr/config.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"fmt"

"github.com/030/n3dr/internal/app/n3dr/config/security"
"github.com/030/n3dr/internal/app/n3dr/connection"
log "github.com/sirupsen/logrus"
Expand All @@ -17,9 +15,12 @@ var configCmd = &cobra.Command{
Short: "config",
Long: `config`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("config called")

n := connection.Nexus3{FQDN: n3drURL, Pass: n3drPass, User: n3drUser}
n := connection.Nexus3{
FQDN: n3drURL,
HTTPS: &https,
Pass: n3drPass,
User: n3drUser,
}
s := security.Security{Nexus3: n}
if err := s.Anonymous(configUserAnonymous); err != nil {
log.Fatal(err)
Expand Down
11 changes: 6 additions & 5 deletions cmd/n3dr/configLDAP.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"fmt"

"github.com/030/n3dr/internal/app/n3dr/config/security"
"github.com/030/n3dr/internal/app/n3dr/connection"
"github.com/030/n3dr/internal/app/n3dr/goswagger/models"
Expand All @@ -22,9 +20,12 @@ var configLDAPCmd = &cobra.Command{
Short: "configLDAP",
Long: `configLDAP`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("configure LDAP")

n := connection.Nexus3{FQDN: n3drURL, Pass: n3drPass, User: n3drUser}
n := connection.Nexus3{
FQDN: n3drURL,
HTTPS: &https,
Pass: n3drPass,
User: n3drUser,
}
s := security.Security{Nexus3: n}
m := models.CreateLdapServerXo{
AuthPassword: &configLDAPAuthPassword,
Expand Down
8 changes: 7 additions & 1 deletion cmd/n3dr/configRepository.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ Examples:
n3dr configRepository -u admin -p some-pass -n localhost:9000 --https=false --configRepoName 3rdparty-rubygems --configRepoType gem
`,
Run: func(cmd *cobra.Command, args []string) {
n := connection.Nexus3{FQDN: n3drURL, Pass: n3drPass, StrictContentTypeValidation: strictContentTypeValidation, User: n3drUser}
n := connection.Nexus3{
FQDN: n3drURL,
HTTPS: &https,
Pass: n3drPass,
StrictContentTypeValidation: strictContentTypeValidation,
User: n3drUser,
}
r := repository.Repository{Nexus3: n}

if configRepoDelete {
Expand Down
11 changes: 6 additions & 5 deletions cmd/n3dr/configUser.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package main

import (
"fmt"

"github.com/030/n3dr/internal/app/n3dr/config/user"
"github.com/030/n3dr/internal/app/n3dr/connection"
"github.com/030/n3dr/internal/app/n3dr/goswagger/models"
Expand All @@ -26,8 +24,6 @@ Examples:
n3dr configUser --changePass --https false --n3drUser admin --n3drURL nexus3:8081 --n3drPass initial-pass --pass some-pass --email [email protected] --firstName admin --id admin --lastName admin
`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("configUser called")

if !admin && !downloadUser && !uploadUser && !changePass {
log.Fatal("either the admin, changePass, downloadUser or uploadUser is required")
}
Expand All @@ -39,7 +35,12 @@ Examples:
Password: pass,
UserID: id,
}
n := connection.Nexus3{FQDN: n3drURL, Pass: n3drPass, User: n3drUser}
n := connection.Nexus3{
FQDN: n3drURL,
HTTPS: &https,
Pass: n3drPass,
User: n3drUser,
}
u := user.User{APICreateUser: acu, Nexus3: n}

if admin {
Expand Down
23 changes: 22 additions & 1 deletion cmd/n3dr/count.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,28 @@ Examples:
n3dr count --csv /tmp/helloworld --sort
`,
Run: func(cmd *cobra.Command, args []string) {
n := connection.Nexus3{AwsBucket: awsBucket, AwsID: awsID, AwsRegion: awsRegion, AwsSecret: awsSecret, BasePathPrefix: basePathPrefix, FQDN: n3drURL, Pass: n3drPass, User: n3drUser, DownloadDirName: downloadDirName, DownloadDirNameZip: downloadDirNameZip, HTTPS: https, DockerHost: dockerHost, DockerPort: dockerPort, DockerPortSecure: dockerPortSecure, ZIP: zip, RepoName: n3drRepo, SkipErrors: skipErrors, WithoutWaitGroups: withoutWaitGroups, WithoutWaitGroupArtifacts: withoutWaitGroupArtifacts, WithoutWaitGroupRepositories: withoutWaitGroupRepositories}
n := connection.Nexus3{
AwsBucket: awsBucket,
AwsID: awsID,
AwsRegion: awsRegion,
AwsSecret: awsSecret,
BasePathPrefix: basePathPrefix,
DockerHost: dockerHost,
DockerPort: dockerPort,
DockerPortSecure: dockerPortSecure,
DownloadDirName: downloadDirName,
DownloadDirNameZip: downloadDirNameZip,
FQDN: n3drURL,
HTTPS: &https,
Pass: n3drPass,
RepoName: n3drRepo,
SkipErrors: skipErrors,
User: n3drUser,
WithoutWaitGroupArtifacts: withoutWaitGroupArtifacts,
WithoutWaitGroupRepositories: withoutWaitGroupRepositories,
WithoutWaitGroups: withoutWaitGroups,
ZIP: zip,
}
c := count.Nexus3{Nexus3: &n, CsvFile: csv, Sort: sort}

if err := c.Artifacts(); err != nil {
Expand Down
23 changes: 22 additions & 1 deletion cmd/n3dr/repositoriesV2.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,28 @@ Examples:
}
log.Fatal("One of the required flags \"names\", \"count\" or \"backup\" not set")
}
n := connection.Nexus3{AwsBucket: awsBucket, AwsID: awsID, AwsRegion: awsRegion, AwsSecret: awsSecret, BasePathPrefix: basePathPrefix, FQDN: n3drURL, Pass: n3drPass, User: n3drUser, DownloadDirName: downloadDirName, DownloadDirNameZip: downloadDirNameZip, HTTPS: https, DockerHost: dockerHost, DockerPort: dockerPort, DockerPortSecure: dockerPortSecure, ZIP: zip, RepoName: n3drRepo, SkipErrors: skipErrors, WithoutWaitGroups: withoutWaitGroups, WithoutWaitGroupArtifacts: withoutWaitGroupArtifacts, WithoutWaitGroupRepositories: withoutWaitGroupRepositories}
n := connection.Nexus3{
AwsBucket: awsBucket,
AwsID: awsID,
AwsRegion: awsRegion,
AwsSecret: awsSecret,
BasePathPrefix: basePathPrefix,
DockerHost: dockerHost,
DockerPort: dockerPort,
DockerPortSecure: dockerPortSecure,
DownloadDirName: downloadDirName,
DownloadDirNameZip: downloadDirNameZip,
FQDN: n3drURL,
HTTPS: &https,
Pass: n3drPass,
RepoName: n3drRepo,
SkipErrors: skipErrors,
User: n3drUser,
WithoutWaitGroupArtifacts: withoutWaitGroupArtifacts,
WithoutWaitGroupRepositories: withoutWaitGroupRepositories,
WithoutWaitGroups: withoutWaitGroups,
ZIP: zip,
}
a := artifactsv2.Nexus3{Nexus3: &n}
c := count.Nexus3{Nexus3: &n, CsvFile: csv}
nn := name.Nexus3{Nexus3: &n}
Expand Down
13 changes: 10 additions & 3 deletions cmd/n3dr/sync.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package main

import (
"fmt"
"sync"

"github.com/030/n3dr/internal/app/n3dr/artifactsv2"
Expand All @@ -23,15 +22,23 @@ var syncCmd = &cobra.Command{
Short: "sync",
Long: `sync`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println("sync called")
numberOfURLs := len(otherNexus3URLs)
numberOfPasswords := len(otherNexus3Passwords)
numberOfUsers := len(otherNexus3Users)
if numberOfURLs != numberOfPasswords || numberOfURLs != numberOfUsers {
log.Fatal("incorrect number of elements. Ensure that the number of elements is identical")
}

n := connection.Nexus3{FQDN: n3drURL, Pass: n3drPass, User: n3drUser, DownloadDirName: downloadDirName, DockerHost: dockerHost, DockerPort: dockerPort, DockerPortSecure: dockerPortSecure}
n := connection.Nexus3{
DockerHost: dockerHost,
DockerPort: dockerPort,
DockerPortSecure: dockerPortSecure,
DownloadDirName: downloadDirName,
FQDN: n3drURL,
HTTPS: &https,
Pass: n3drPass,
User: n3drUser,
}
a := artifactsv2.Nexus3{Nexus3: &n}
if err := a.Backup(); err != nil {
log.Fatal(err)
Expand Down
21 changes: 16 additions & 5 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,20 @@
## [Unreleased]


<a name="7.2.5"></a>
## [7.2.5] - 2023-08-25
### Build
- **deps:** Update versions.
<a name="7.3.1"></a>
## [7.3.1] - 2023-10-14
### Fix
- [[#381](https://github.com/030/n3dr/issues/381)] 405 not allowed when creating repositories as 'https' could not be enabled.


<a name="7.3.0"></a>
## [7.3.0] - 2023-10-14
### Fix
- [[#378](https://github.com/030/n3dr/issues/378)] Change initial admin pass (automatically).


<a name="7.2.5"></a>
## [7.2.5] - 2023-08-26

<a name="7.2.4"></a>
## [7.2.4] - 2023-07-27
Expand Down Expand Up @@ -385,7 +394,9 @@ The `backup`, `upload` and `repositories` commands have been removed.
<a name="1.0.0"></a>
## 1.0.0 - 2019-05-12

[Unreleased]: https://github.com/030/n3dr/compare/7.2.5...HEAD
[Unreleased]: https://github.com/030/n3dr/compare/7.3.1...HEAD
[7.3.1]: https://github.com/030/n3dr/compare/7.3.0...7.3.1
[7.3.0]: https://github.com/030/n3dr/compare/7.2.5...7.3.0
[7.2.5]: https://github.com/030/n3dr/compare/7.2.4...7.2.5
[7.2.4]: https://github.com/030/n3dr/compare/7.2.3...7.2.4
[7.2.3]: https://github.com/030/n3dr/compare/7.2.2...7.2.3
Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ n3dr config \
### Build

```bash
docker build -t utrecht/n3dr:7.2.5 .
docker build -t utrecht/n3dr:7.3.1 .
```

[![dockeri.co](https://dockeri.co/image/utrecht/n3dr)](https://hub.docker.com/r/utrecht/n3dr)
Expand All @@ -248,7 +248,7 @@ docker build -t utrecht/n3dr:7.2.5 .
```bash
docker run -it \
-v /home/${USER}/.n3dr:/root/.n3dr \
-v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:7.2.5
-v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:7.3.1
```

### Upload
Expand All @@ -257,7 +257,7 @@ docker run -it \
docker run -it \
--entrypoint=/bin/ash \
-v /home/${USER}/.n3dr:/root/.n3dr \
-v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:7.2.5
-v /tmp/n3dr:/tmp/n3dr utrecht/n3dr:7.3.1
```

navigate to the repository folder, e.g. `/tmp/n3dr/download*/` and upload:
Expand Down
6 changes: 3 additions & 3 deletions docs/quickstarts/snippets/n3dr/DOWNLOAD.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Download

Download the [latest N3DR binary](https://github.com/030/n3dr/releases/tag/7.2.5):
Download the [latest N3DR binary](https://github.com/030/n3dr/releases/tag/7.3.1):

```bash
cd /tmp && \
curl -L https://github.com/030/n3dr/releases/download/7.2.5/n3dr-ubuntu-latest \
curl -L https://github.com/030/n3dr/releases/download/7.3.1/n3dr-ubuntu-latest \
-o n3dr-ubuntu-latest && \
curl -L https://github.com/030/n3dr/releases/download/7.2.5/\
curl -L https://github.com/030/n3dr/releases/download/7.3.1/\
n3dr-ubuntu-latest.sha512.txt \
-o n3dr-ubuntu-latest.sha512.txt && \
sha512sum -c n3dr-ubuntu-latest.sha512.txt && \
Expand Down
Loading

0 comments on commit b01abfd

Please sign in to comment.