Skip to content

Commit 81f707b

Browse files
authored
Merge pull request #12 from payamQorbanpour/feature/data_center_migration
Feature/data center migration
2 parents 936eb89 + 5f6c43f commit 81f707b

1 file changed

Lines changed: 9 additions & 4 deletions

File tree

pkg/paas/migration.go

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ func NewCmdMigrate(in io.Reader, out, errout io.Writer) *cobra.Command {
122122

123123
if response.StatusCode == http.StatusOK {
124124
if response.State == Completed || response.State == Failed {
125+
fmt.Println("\nLast migration report is as bellow:")
125126
migrate(request)
126127
reMigrationConfirmed := reMigrationConfirm(in, explainOut)
127128
if !reMigrationConfirmed {
@@ -274,7 +275,7 @@ func migrationConfirm(project, region string, in io.Reader, writer io.Writer) bo
274275
if err != nil {
275276
return false
276277
}
277-
inputExplain := fmt.Sprintf(yellowColor+"\nWARNING: This will STOP your applications during migration process.\nYour data would still be safe and available in source region.\nMigration is running in the background and may take a while.\nYou can optionally detach(Ctrl+C) for now and\ncontinue monitoring the process after using 'arvan paas migrate'."+resetColor+"\n\nPlease enter project's name [%s] to proceed: ", project)
278+
inputExplain := fmt.Sprintf(yellowColor+"\nWARNING:\nThis will STOP applications during migration process. Your data would still be safe and available in source region. Migration is running in the background and may take a while. You can optionally detach(Ctrl+C) for now and continue monitoring the process after using 'arvan paas migrate'."+resetColor+"\n\nPlease enter project's name [%s] to proceed: ", project)
278279

279280
defaultVal := ""
280281

@@ -327,6 +328,10 @@ func migrate(request Request) error {
327328
}
328329

329330
if response.State == Failed {
331+
stopChannel <- true
332+
tabWriter.Flush()
333+
uiliveWriter.Stop()
334+
330335
failureOutput(response.Steps[len(response.Steps)-1].Data.Detail)
331336
}
332337
})
@@ -462,7 +467,7 @@ func failureOutput(message string) {
462467

463468
// successOutput displays success output.
464469
func successOutput(data StepData) {
465-
fmt.Println("\nYour namespaces successfully migrated!")
470+
fmt.Println("\nNamespaces successfully migrated!")
466471

467472
if len(data.Source.Services) > 0 {
468473
ipTable := tablewriter.NewWriter(os.Stdout)
@@ -491,7 +496,7 @@ func successOutput(data StepData) {
491496
}
492497

493498
if len(freeSourceDomains) > 0 {
494-
fmt.Println("Your free domains changed successfully:")
499+
fmt.Println("Free domains changed successfully:")
495500

496501
freeDomainTable := tablewriter.NewWriter(os.Stdout)
497502
freeDomainTable.SetHeader([]string{"old free domains", "new free domains"})
@@ -518,7 +523,7 @@ func successOutput(data StepData) {
518523
gatewayTable := tablewriter.NewWriter(os.Stdout)
519524
gatewayTable.SetHeader([]string{"old gateway", "new gateway"})
520525

521-
fmt.Println("For non-free domains above, please change your gateway in your DNS provider as bellow:")
526+
fmt.Println("For non-free domains above, please change gateway in DNS provider as bellow:")
522527
gatewayTable.Append([]string{redColor + data.Source.Gateway + resetColor, greenColor + data.Destination.Gateway + resetColor})
523528
gatewayTable.Render()
524529
}

0 commit comments

Comments
 (0)