shine
shine copied to clipboard
fix shine install -L
Should only perform the install on the local node (like -n $HOSTNAME)
-L is already implemented as -n $HOSTNAME internally.
This patch should do the trick:
Ticket #209: support -L flag for 'install' command
Call init_execute() also for 'install' command like
all other FSLiveCommand classes.
diff --git a/lib/Shine/Commands/Base/Command.py b/lib/Shine/Commands/Base/Command.py
index 886082b..d4ef640 100644
--- a/lib/Shine/Commands/Base/Command.py
+++ b/lib/Shine/Commands/Base/Command.py
@@ -87,6 +87,19 @@ class Command(object):
# default is to not filter return code
return rc
+ def has_local_flag(self):
+ return self.options.local or self.options.remote
+
+ def init_execute(self):
+ """
+ Initialize execution of remote command, if needed. Should be called
+ first from derived classes before really executing the command.
+ """
+ # Limit the scope of the command if called with local flag (-L) or
+ # called remotely (-R).
+ if self.has_local_flag():
+ self.options.nodes = NodeSet(Server.hostname_short())
+
def iter_fsname(self):
# If some labels are specified, they also specifies some fs names.
@@ -182,19 +195,6 @@ class RemoteCommand(Command):
Command.__init__(self, options, args)
self.eventhandler = None
- def has_local_flag(self):
- return self.options.local or self.options.remote
-
- def init_execute(self):
- """
- Initialize execution of remote command, if needed. Should be called
- first from derived classes before really executing the command.
- """
- # Limit the scope of the command if called with local flag (-L) or
- # called remotely (-R).
- if self.has_local_flag():
- self.options.nodes = NodeSet(Server.hostname_short())
-
def install_eventhandler(self, local_eventhandler, global_eventhandler):
"""
Select and install the appropriate event handler.
diff --git a/lib/Shine/Commands/Install.py b/lib/Shine/Commands/Install.py
index 5b70ac3..350dc9a 100644
--- a/lib/Shine/Commands/Install.py
+++ b/lib/Shine/Commands/Install.py
@@ -54,6 +54,8 @@ class Install(Command):
raise CommandHelpException("Lustre model file path"
"(-m <model_file>) argument required.", self)
+ self.init_execute()
+
eh = FSGlobalEventHandler(self)
# Use this Shine.FSUtils convenience function.