예제 #1
0
    def plugin_info(self, args):
        desc, version = self.c.plugin_info()

        if args.sep:
            out("%s%s%s" % (desc, args.sep, version))
        else:
            out("Description: %s Version: %s" % (desc, version))
예제 #2
0
 def display_nfs_client_authentication(self):
     """
     Dump the supported nfs client authentication types
     """
     if self.args.sep:
         out(self.args.sep.join(self.c.export_auth()))
     else:
         out(", ".join(self.c.export_auth()))
예제 #3
0
    def job_status(self, args):
        (s, percent, item) = self.c.job_status(args.job)

        if s == JobStatus.COMPLETE:
            if item:
                self.display_data([item])

            self.c.job_free(args.job)
        else:
            out(str(percent))
            self.shutdown(ErrorNumber.JOB_STARTED)
예제 #4
0
    def _cp(self, cap, val):
        if self.args.sep is not None:
            s = self.args.sep
        else:
            s = ':'

        if val:
            v = "SUPPORTED"
        else:
            v = "UNSUPPORTED"

        out("%s%s%s" % (cap, s, v))
예제 #5
0
    def confirm_prompt(self, deleting):
        """
        Give the user a chance to bail.
        """
        if not self.args.force:
            msg = "will" if deleting else "may"
            out("Warning: You are about to do an operation that %s cause data "
                "to be lost!\nPress [Y|y] to continue, any other key to abort"
                % msg)

            pressed = getch()
            if pressed.upper() == 'Y':
                return True
            else:
                out('Operation aborted!')
                return False
        else:
            return True
예제 #6
0
    def _wait_for_it(self, msg, job, item):
        if not job:
            return item
        else:
            #If a user doesn't want to wait, return the job id to stdout
            #and exit with job in progress
            if self.args.async:
                out(job)
                self.shutdown(ErrorNumber.JOB_STARTED)

            while True:
                (s, percent, item) = self.c.job_status(job)

                if s == JobStatus.INPROGRESS:
                    #Add an option to spit out progress?
                    #print "%s - Percent %s complete" % (job, percent)
                    time.sleep(0.25)
                elif s == JobStatus.COMPLETE:
                    self.c.job_free(job)
                    return item
                else:
                    #Something better to do here?
                    raise ArgError(msg + " job error code= " + str(s))
예제 #7
0
 def fs_dependants(self, args):
     fs = _get_item(self.c.fs(), args.fs, "File System")
     rc = self.c.fs_child_dependency(fs, args.file)
     out(rc)
예제 #8
0
 def volume_dependants(self, args):
     v = _get_item(self.c.volumes(), args.vol, "Volume")
     rc = self.c.volume_child_dependency(v)
     out(rc)
예제 #9
0
 def volume_replicate_range_block_size(self, args):
     s = _get_item(self.c.systems(), args.sys, "System")
     out(self.c.volume_replicate_range_block_size(s))