Commit d52598c5 authored by Addshore's avatar Addshore 🏄
Browse files

mwdd: Add exec commands for all services

Bug: T282394
Change-Id: I8bc832f47fe137928be859f7d89175cc7acbe064
parent e07e3c43
......@@ -80,11 +80,26 @@ var mwddAdminerResumeCmd = &cobra.Command{
},
}
var mwddAdminerExecCmd = &cobra.Command{
Use: "exec [flags] [command...]",
Example: " exec bash\n exec -- bash --help\n exec --user root bash\n exec --user root -- bash --help",
Short: "Executes a command in the Adminer container",
Run: func(cmd *cobra.Command, args []string) {
mwdd.DefaultForUser().EnsureReady()
mwdd.DefaultForUser().DockerExec(mwdd.DockerExecCommand{
DockerComposeService: "adminer",
Command: args,
User: User,
})
},
}
func init() {
mwddCmd.AddCommand(mwddAdminerCmd)
mwddAdminerCmd.AddCommand(mwddAdminerCreateCmd)
mwddAdminerCmd.AddCommand(mwddAdminerDestroyCmd)
mwddAdminerCmd.AddCommand(mwddAdminerSuspendCmd)
mwddAdminerCmd.AddCommand(mwddAdminerResumeCmd)
mwddAdminerCmd.AddCommand(mwddAdminerExecCmd)
mwddMediawikiCmd.AddCommand(mwddMediawikiPhpunitCmd)
}
......@@ -81,10 +81,25 @@ var mwddGraphiteResumeCmd = &cobra.Command{
},
}
var mwddGraphiteExecCmd = &cobra.Command{
Use: "exec [flags] [command...]",
Example: " exec bash\n exec -- bash --help\n exec --user root bash\n exec --user root -- bash --help",
Short: "Executes a command in the Graphite container",
Run: func(cmd *cobra.Command, args []string) {
mwdd.DefaultForUser().EnsureReady()
mwdd.DefaultForUser().DockerExec(mwdd.DockerExecCommand{
DockerComposeService: "graphite",
Command: args,
User: User,
})
},
}
func init() {
mwddCmd.AddCommand(mwddGraphiteCmd)
mwddGraphiteCmd.AddCommand(mwddGraphiteCreateCmd)
mwddGraphiteCmd.AddCommand(mwddGraphiteDestroyCmd)
mwddGraphiteCmd.AddCommand(mwddGraphiteSuspendCmd)
mwddGraphiteCmd.AddCommand(mwddGraphiteResumeCmd)
mwddGraphiteCmd.AddCommand(mwddGraphiteExecCmd)
}
......@@ -81,10 +81,25 @@ var mwddMySQLReplicaResumeCmd = &cobra.Command{
},
}
var mwddMySQLReplicaExecCmd = &cobra.Command{
Use: "exec [flags] [command...]",
Example: " exec bash\n exec -- bash --help\n exec --user root bash\n exec --user root -- bash --help",
Short: "Executes a command in the MySQL Replica container",
Run: func(cmd *cobra.Command, args []string) {
mwdd.DefaultForUser().EnsureReady()
mwdd.DefaultForUser().DockerExec(mwdd.DockerExecCommand{
DockerComposeService: "mysql-replica",
Command: args,
User: User,
})
},
}
func init() {
mwddCmd.AddCommand(mwddMySQLReplicaCmd)
mwddMySQLReplicaCmd.AddCommand(mwddMySQLReplicaCreateCmd)
mwddMySQLReplicaCmd.AddCommand(mwddMySQLReplicaDestroyCmd)
mwddMySQLReplicaCmd.AddCommand(mwddMySQLReplicaSuspendCmd)
mwddMySQLReplicaCmd.AddCommand(mwddMySQLReplicaResumeCmd)
mwddMySQLReplicaCmd.AddCommand(mwddMySQLReplicaExecCmd)
}
......@@ -81,10 +81,25 @@ var mwddMySQLResumeCmd = &cobra.Command{
},
}
var mwddMySQLExecCmd = &cobra.Command{
Use: "exec [flags] [command...]",
Example: " exec bash\n exec -- bash --help\n exec --user root bash\n exec --user root -- bash --help",
Short: "Executes a command in the MySQL container",
Run: func(cmd *cobra.Command, args []string) {
mwdd.DefaultForUser().EnsureReady()
mwdd.DefaultForUser().DockerExec(mwdd.DockerExecCommand{
DockerComposeService: "mysql",
Command: args,
User: User,
})
},
}
func init() {
mwddCmd.AddCommand(mwddMySQLCmd)
mwddMySQLCmd.AddCommand(mwddMySQLCreateCmd)
mwddMySQLCmd.AddCommand(mwddMySQLDestroyCmd)
mwddMySQLCmd.AddCommand(mwddMySQLSuspendCmd)
mwddMySQLCmd.AddCommand(mwddMySQLResumeCmd)
mwddMySQLCmd.AddCommand(mwddMySQLExecCmd)
}
......@@ -81,10 +81,25 @@ var mwddPhpMyAdminResumeCmd = &cobra.Command{
},
}
var mwddPhpMyAdminExecCmd = &cobra.Command{
Use: "exec [flags] [command...]",
Example: " exec bash\n exec -- bash --help\n exec --user root bash\n exec --user root -- bash --help",
Short: "Executes a command in the PhpMyAdmin container",
Run: func(cmd *cobra.Command, args []string) {
mwdd.DefaultForUser().EnsureReady()
mwdd.DefaultForUser().DockerExec(mwdd.DockerExecCommand{
DockerComposeService: "phpmyadmin",
Command: args,
User: User,
})
},
}
func init() {
mwddCmd.AddCommand(mwddPhpMyAdminCmd)
mwddPhpMyAdminCmd.AddCommand(mwddPhpMyAdminCreateCmd)
mwddPhpMyAdminCmd.AddCommand(mwddPhpMyAdminDestroyCmd)
mwddPhpMyAdminCmd.AddCommand(mwddPhpMyAdminSuspendCmd)
mwddPhpMyAdminCmd.AddCommand(mwddPhpMyAdminResumeCmd)
mwddPhpMyAdminCmd.AddCommand(mwddPhpMyAdminExecCmd)
}
......@@ -81,10 +81,25 @@ var mwddPostgresResumeCmd = &cobra.Command{
},
}
var mwddPostgresExecCmd = &cobra.Command{
Use: "exec [flags] [command...]",
Example: " exec bash\n exec -- bash --help\n exec --user root bash\n exec --user root -- bash --help",
Short: "Executes a command in the Postgres container",
Run: func(cmd *cobra.Command, args []string) {
mwdd.DefaultForUser().EnsureReady()
mwdd.DefaultForUser().DockerExec(mwdd.DockerExecCommand{
DockerComposeService: "postgres",
Command: args,
User: User,
})
},
}
func init() {
mwddCmd.AddCommand(mwddPostgresCmd)
mwddPostgresCmd.AddCommand(mwddPostgresCreateCmd)
mwddPostgresCmd.AddCommand(mwddPostgresDestroyCmd)
mwddPostgresCmd.AddCommand(mwddPostgresSuspendCmd)
mwddPostgresCmd.AddCommand(mwddPostgresResumeCmd)
mwddPostgresCmd.AddCommand(mwddPostgresExecCmd)
}
......@@ -81,6 +81,20 @@ var mwddRedisResumeCmd = &cobra.Command{
},
}
var mwddRedisExecCmd = &cobra.Command{
Use: "exec [flags] [command...]",
Example: " exec bash\n exec -- bash --help\n exec --user root bash\n exec --user root -- bash --help",
Short: "Executes a command in the Redis container",
Run: func(cmd *cobra.Command, args []string) {
mwdd.DefaultForUser().EnsureReady()
mwdd.DefaultForUser().DockerExec(mwdd.DockerExecCommand{
DockerComposeService: "redis",
Command: args,
User: User,
})
},
}
var mwddRedisCliCmd = &cobra.Command{
Use: "cli",
Short: "Redis CLI for the container",
......@@ -99,5 +113,6 @@ func init() {
mwddRedisCmd.AddCommand(mwddRedisDestroyCmd)
mwddRedisCmd.AddCommand(mwddRedisSuspendCmd)
mwddRedisCmd.AddCommand(mwddRedisResumeCmd)
mwddRedisCmd.AddCommand(mwddRedisExecCmd)
mwddRedisCmd.AddCommand(mwddRedisCliCmd)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment