pkg/environment: Migrate fs functions to fsx
This commit is contained in:
parent
45540ab253
commit
5a43ecfaeb
21 changed files with 155 additions and 199 deletions
|
|
@ -65,7 +65,7 @@ func (ssh2 *SSH2) UseOrMakeHostKey(progress io.Writer, ctx context.Context, serv
|
|||
func (ssh2 *SSH2) ReadOrMakeHostKey(progress io.Writer, ctx context.Context, privateKeyPath string, algorithm HostKeyAlgorithm) (key gossh.Signer, err error) {
|
||||
hostKey := NewHostKey(algorithm)
|
||||
|
||||
if _, e := os.Lstat(privateKeyPath); environment.IsNotExist(e) { // path doesn't exist => generate a new key there!
|
||||
if _, e := os.Lstat(privateKeyPath); os.IsNotExist(e) { // path doesn't exist => generate a new key there!
|
||||
err = ssh2.makeHostKey(progress, ctx, hostKey, privateKeyPath)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "Unable to generate new host key")
|
||||
|
|
@ -84,7 +84,7 @@ func (ssh2 *SSH2) loadHostKey(progress io.Writer, ctx context.Context, key HostK
|
|||
logging.ProgressF(progress, ctx, "Loading hostkey (algorithm %s) from %q", key.Algorithm(), path)
|
||||
|
||||
// read all the bytes from the file
|
||||
privateKeyBytes, err := environment.ReadFile(ssh2.Environment, path)
|
||||
privateKeyBytes, err := os.ReadFile(path)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "Unable to read private key bytes")
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue