We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 06b6842 commit f06f112Copy full SHA for f06f112
cmd/podman/system/connection/add.go
@@ -141,6 +141,19 @@ func add(cmd *cobra.Command, args []string) error {
141
142
switch uri.Scheme {
143
case "ssh":
144
+ // ensure the Identity provided is a valid file
145
+ info, err := os.Stat(entities.Identity)
146
+ switch {
147
+ case errors.Is(err, os.ErrNotExist):
148
+ logrus.Warnf("%q does not exist", entities.Identity)
149
+ case errors.Is(err, os.ErrPermission):
150
+ logrus.Warnf("You do not have permission to read %q", entities.Identity)
151
+ case err != nil:
152
+ return err
153
+ case info.IsDir():
154
+ return fmt.Errorf("%q is a directory", entities.Identity)
155
+ }
156
+
157
return ssh.Create(entities, sshMode)
158
case "unix":
159
if cmd.Flags().Changed("identity") {
0 commit comments