@@ -120,18 +120,16 @@ func NewCmdMigrate(in io.Reader, out, errout io.Writer) *cobra.Command {
120120 return
121121 }
122122
123- if response .StatusCode == http .StatusOK {
124- if response .State == Completed || response .State == Failed {
125- fmt .Printf ("\n Last migration report of projetct \" %s\" is as bellow:\n " , response .Namespace )
126- migrate (request )
127- reMigrationConfirmed := reMigrationConfirm (in , explainOut )
128- if ! reMigrationConfirmed {
129- return
130- }
123+ if response .StatusCode == http .StatusOK && (response .State == Completed || response .State == Failed ) {
124+ fmt .Printf ("\n Last migration report of projetct \" %s\" is as bellow:\n " , response .Namespace )
125+ migrate (request )
126+ reMigrationConfirmed := reMigrationConfirm (in , explainOut )
127+ if ! reMigrationConfirmed {
128+ return
131129 }
132130 }
133131
134- if response .StatusCode == http . StatusNotFound || response .StatusCode == http . StatusOK {
132+ if response .State == Completed || response .State == Failed {
135133 project , err := getSelectedProject (in , explainOut )
136134 if err != nil {
137135 failureOutput (err .Error ())
@@ -155,10 +153,7 @@ func NewCmdMigrate(in io.Reader, out, errout io.Writer) *cobra.Command {
155153 request .Namespace = project
156154 request .Destination = fmt .Sprintf ("%s-%s" , destinationRegion .RegionName , destinationRegion .Name )
157155
158- }
159-
160- if response .StatusCode != http .StatusFound {
161- err := httpPost (fmt .Sprintf (migrationEndpoint , request .Source ), request )
156+ err = httpPost (fmt .Sprintf (migrationEndpoint , request .Source ), request )
162157 if err != nil {
163158 failureOutput (err .Error ())
164159 return
0 commit comments