Skip to content

Commit

Permalink
Merge pull request #125 from gid-lap/app-master-ssh
Browse files Browse the repository at this point in the history
[FBZ-7928] add app master option for ssh to only run cmd on an env's app master
  • Loading branch information
mushyy authored Oct 27, 2021
2 parents 392ffa3 + 6000524 commit 09fa2e7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/ey-core/cli/helpers/server_sieve.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class ServerSieve
ROLES = [
:app_servers,
:db_servers,
:app_master,
:db_master,
:utilities
]
Expand Down Expand Up @@ -56,6 +57,12 @@ def app_servers
def db_servers
db_master + servers_api.all(role: 'db_slave').to_a
end

def app_master
['app_master', 'solo'].
map {|role| servers_api.all(role:role).to_a}.
flatten
end

def db_master
['db_master', 'solo'].
Expand Down
6 changes: 6 additions & 0 deletions lib/ey-core/cli/ssh.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class Ssh < Subcommand
long: "app_servers",
description: "Run command on all application servers"

switch :app_master,
long: "app_master",
description: "Run command on app master"

switch :db_servers,
long: "db_servers",
description: "Run command on all database servers"
Expand Down Expand Up @@ -97,6 +101,7 @@ def handle
environment.servers,
all: switch_active?(:all),
app_servers: switch_active?(:app_servers),
app_master: switch_active?(:app_master),
db_servers: switch_active?(:db_servers),
db_master: switch_active?(:db_master),
utilities: option(:utilities)
Expand All @@ -113,6 +118,7 @@ def handle
environment.servers,
all: switch_active?(:all),
app_servers: switch_active?(:app_servers),
app_master: switch_active?(:app_master),
db_servers: switch_active?(:db_servers),
db_master: switch_active?(:db_master),
utilities: option(:utilities)
Expand Down

0 comments on commit 09fa2e7

Please sign in to comment.