@@ -28,6 +28,7 @@ class CommandType(Enum):
2828 LOG = auto ()
2929 INIT = auto ()
3030 HELP = auto ()
31+ UPDATE = auto ()
3132
3233@dataclass
3334class CommandArgs :
@@ -50,6 +51,7 @@ class CommandArgs:
5051 body : Optional [str ] = None
5152 namespace : Optional [str ] = None
5253 force_local : bool = False
54+ update : bool = False
5355
5456class Command :
5557 def __init__ (self , args : CommandArgs ):
@@ -75,7 +77,8 @@ def execute(self) -> None:
7577 CommandType .MIGRATE : self ._handle_migrate ,
7678 CommandType .LOG : self ._handle_log ,
7779 CommandType .INIT : self ._handle_init ,
78- CommandType .HELP : self ._handle_help
80+ CommandType .HELP : self ._handle_help ,
81+ CommandType .UPDATE : self ._handle_update ,
7982 }
8083 handler = command_handlers .get (command_type )
8184 if handler :
@@ -95,6 +98,7 @@ def _determine_command_type(self) -> CommandType:
9598 if self .args .migrate : return CommandType .MIGRATE
9699 if self .args .log : return CommandType .LOG
97100 if self .args .init : return CommandType .INIT
101+ if self .args .update : return CommandType .UPDATE
98102 return CommandType .HELP
99103
100104 def _handle_default (self ) -> None :
@@ -128,6 +132,9 @@ def _handle_restart(self) -> None:
128132 def _handle_status (self ) -> None :
129133 print (json .dumps (_Director .status_production (), indent = 4 ))
130134
135+ def _handle_update (self ) -> None :
136+ _Director .update_production ()
137+
131138 def _handle_test (self ) -> None :
132139 test_name = None if self .args .test == 'not_set' else self .args .test
133140 response = _Director .test_component (
@@ -164,6 +171,7 @@ def _handle_help(self) -> None:
164171 create_parser ().print_help ()
165172 try :
166173 print (f"\n Default production: { _Director .get_default_production ()} " )
174+ print (f"\n Namespace: { os .getenv ('IRISNAMESPACE' ,'not set' )} " )
167175 except Exception :
168176 logging .warning ("Could not retrieve default production." )
169177
@@ -186,6 +194,7 @@ def create_parser() -> argparse.ArgumentParser:
186194 parser .add_argument ('-L' , '--log' , help = 'display log' , nargs = '?' , const = 'not_set' )
187195 parser .add_argument ('-i' , '--init' , help = 'init the pex module in iris' , nargs = '?' , const = 'not_set' )
188196 parser .add_argument ('-t' , '--test' , help = 'test the pex module in iris' , nargs = '?' , const = 'not_set' )
197+ parser .add_argument ('-u' , '--update' , help = 'update a production' , action = 'store_true' )
189198
190199 # Command groups
191200 start = main_parser .add_argument_group ('start arguments' )
0 commit comments