Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix shine install -L #209

Open
thiell opened this issue Jul 16, 2019 · 1 comment
Open

fix shine install -L #209

thiell opened this issue Jul 16, 2019 · 1 comment

Comments

@thiell
Copy link
Contributor

thiell commented Jul 16, 2019

Should only perform the install on the local node (like -n $HOSTNAME)

@degremont
Copy link
Collaborator

-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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants