@@ -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 .Println ("\n Last migration report is as bellow:" )
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
@@ -365,7 +360,7 @@ func sprintResponse(response ProgressResponse, w io.Writer) error {
365360 detail = s .Data .Detail
366361 }
367362
368- responseStr += fmt .Sprintf ("\t %d-% s \t \t \t %s\t %s\n " , s . Order , s .Title , strings .Title (s .State ), detail )
363+ responseStr += fmt .Sprintf ("\t %s \t \t \t %s\t %s\n " , s .Title , strings .Title (s .State ), detail )
369364 }
370365
371366 fmt .Fprintf (w , "%s" , responseStr )
@@ -444,6 +439,7 @@ func httpGet(endpoint string) (*ProgressResponse, error) {
444439 httpReq .Header .Add ("User-Agent" , rest .DefaultKubernetesUserAgent ())
445440 httpResp , err := http .DefaultClient .Do (httpReq )
446441 if err != nil {
442+ failureOutput ("Migration is running in the background. You can continue monitoring the process using 'arvan paas migrate'." )
447443 return nil , err
448444 }
449445
0 commit comments