Skip to content

Commit

Permalink
Revert artifactory cli stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
wyarde committed Apr 6, 2021
1 parent d24b547 commit 560dea9
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 77 deletions.
11 changes: 0 additions & 11 deletions src/cmd/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ func ConfigureNpm() error {
return err
}

func ConfigureArtifactoryCli() error {
log.Debug(" Start of ConfigureArtifactoryCli")
err := configureArtifactoryCli()
log.Debug(" End of ConfigureArtifactoryCli")

return err
}

func main() {
log.SetFormatter(&log.TextFormatter{TimestampFormat: time.RFC3339Nano})
log.SetLevel(log.DebugLevel)
Expand All @@ -51,8 +43,5 @@ func main() {
err = ConfigureNpm()
checkIfError(err)

err = ConfigureArtifactoryCli()
checkIfError(err)

log.Info("Done!")
}
41 changes: 1 addition & 40 deletions src/cmd/agent/agent_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func configureNpm() error {

for _, prefix := range []string{"/usr", "/usr/local"} {
path := filepath.Join(prefix, "etc")
npmrcFile := filePath.Join(path, "npmrc")
npmrcFile := filepath.Join(path, "npmrc")

log.WithField("npmrcFile", npmrcFile).Debug()

Expand All @@ -72,42 +72,3 @@ func configureNpm() error {

return nil
}

func configureArtifactoryCli() error {
cert, err := getCert()
if err != nil {
return err
}

f, err := os.Open("/home")
if err != nil {
return err
}
defer f.Close()

users, err := f.Readdirnames(0)
if err != nil {
return err
}

defaultPaths := []string{"/root", "/etc/skel"}
paths := append(defaultPaths, users...)

for _, path := range paths {
log.WithField("path", path).Debug(" Adding Artifactory CLI configuration...")

certPath := filepath.Join(path, ".jfrog/security/certs")
err = os.MkdirAll(certPath, os.ModePerm)
if err != nil {
return err
}

f := filepath.Join(certPath, "cert.pem")
err = os.WriteFile(f, cert, 0444)
if err != nil {
return err
}
}

return nil
}
4 changes: 0 additions & 4 deletions src/cmd/agent/agent_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,3 @@ func configureNpm() error {

return nil
}

func configureArtifactoryCli() error {
return nil
}
22 changes: 0 additions & 22 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,28 +57,6 @@ func execInContainer(ctx context.Context, cli *client.Client, id string, command
return output, nil
}

// func Generate(input ...string) (io.Reader, error) {
// files := parseStringPairs(input...)
// buf := new(bytes.Buffer)
// tw := tar.NewWriter(buf)
// for _, file := range files {
// name, content := file[0], file[1]
// hdr := &tar.Header{
// Name: name,
// Size: int64(len(content)),
// }
// if err := tw.WriteHeader(hdr); err != nil {
// return nil, err
// }
// if _, err := tw.Write([]byte(content)); err != nil {
// return nil, err
// }
// }
// if err := tw.Close(); err != nil {
// return nil, err
// }
// return buf, nil

// File holds the filename and its content
type File struct {
Name string
Expand Down

0 comments on commit 560dea9

Please sign in to comment.