Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/pwcmd'
Browse files Browse the repository at this point in the history
  • Loading branch information
majewsky committed Jan 3, 2024
2 parents f1615f8 + 3bd1732 commit 9619167
Show file tree
Hide file tree
Showing 10 changed files with 509 additions and 10 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ require (
github.com/gophercloud/utils v0.0.0-20231010081019-80377eca5d56
github.com/olekukonko/tablewriter v0.0.5
github.com/sapcc/go-api-declarations v1.10.6
github.com/sapcc/go-bits v0.0.0-20231221010852-98deb05b5d97
github.com/sapcc/gophercloud-sapcc v0.0.0-20240103103531-2411033406f1
github.com/spf13/cobra v1.8.0
)
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,12 @@ github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sapcc/go-api-declarations v1.10.6 h1:WtdxsNon5g7NMxcDWL/obe8cW8QjPwfBlnjq975s0qM=
github.com/sapcc/go-api-declarations v1.10.6/go.mod h1:83R3hTANhuRXt/pXDby37IJetw8l7DG41s33Tp9NXxI=
github.com/sapcc/go-bits v0.0.0-20231221010852-98deb05b5d97 h1:hUBB+owZ3eqoG5BiDmlHglUKjM9zLfz15m5Q8gb9gzA=
github.com/sapcc/go-bits v0.0.0-20231221010852-98deb05b5d97/go.mod h1:wEFayuwafHrMvuG4rT7d4AV5BQiopTA4UndFP3CuwMI=
github.com/sapcc/gophercloud-sapcc v0.0.0-20240103103531-2411033406f1 h1:fCojAY2lSKtD4LxNaAJqfN6qyGKGqLYlLHNFAamnKtI=
github.com/sapcc/gophercloud-sapcc v0.0.0-20240103103531-2411033406f1/go.mod h1:9ncsQIHIbSJlBI0Af0uXKHqFkb3A3uLlS1SUovsaNw4=
github.com/sergi/go-diff v1.3.1 h1:xkr+Oxo4BOQKmkn/B9eMK0g5Kg/983T9DqqPHwYqD+8=
github.com/sergi/go-diff v1.3.1/go.mod h1:aMJSSKb2lpPvRNec0+w3fl7LP9IOFzdc9Pa4NFbPK1I=
github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0=
github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho=
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
Expand Down
13 changes: 3 additions & 10 deletions internal/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,12 @@ import (
"fmt"
"net/http"
"os"
"os/exec"
"strings"

"github.com/gophercloud/gophercloud"
"github.com/gophercloud/gophercloud/openstack"
"github.com/gophercloud/utils/client"
"github.com/gophercloud/utils/openstack/clientconfig"
"github.com/sapcc/go-bits/secrets"
"github.com/sapcc/gophercloud-sapcc/clients"
"github.com/spf13/cobra"

Expand Down Expand Up @@ -109,14 +108,8 @@ func authenticate() (*gophercloud.ProviderClient, error) {
// Update OpenStack environment variables, if value(s) provided as flag.
updateOpenStackEnvVars()

pwCmd := os.Getenv("OS_PW_CMD")
if pwCmd != "" && os.Getenv("OS_PASSWORD") == "" {
// Retrieve user's password from external command.
out, err := exec.Command("sh", "-c", pwCmd).Output()
if err != nil {
return nil, util.WrapError(err, fmt.Sprintf("could not retrieve user password using: %s", pwCmd))
}
setenvIfVal("OS_PASSWORD", strings.TrimSuffix(string(out), "\n"))
if err := secrets.GetPasswordFromCommandIfRequested(); err != nil {
return nil, err
}
ao, err := clientconfig.AuthOptions(nil)
if err != nil {
Expand Down
201 changes: 201 additions & 0 deletions vendor/github.com/sapcc/go-bits/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

97 changes: 97 additions & 0 deletions vendor/github.com/sapcc/go-bits/logg/log.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions vendor/github.com/sapcc/go-bits/osext/doc.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9619167

Please sign in to comment.