Exemplo n.º 1
0
    def do_color(self, args, arguments):
        """
        ::
        
          Usage:
              color on
              color off
              color

              Turns the shell color printing on or off

          Description:

              color on   switched the color on

              color off  switches the color off

              color      without parameters prints a test to display
                         the various colored mesages. It is intended
                         as a test to see if your terminal supports
                         colors.

        """
        if arguments['on']:
            key = "cloudmesh.shell.color"
            value = True
            self.cm_config._update(key, value)
            self.cm_config.write(output="yaml")
            Console.color = True
            print("color on.")
        elif arguments['off']:
            key = "cloudmesh.shell.color"
            value = False
            self.cm_config._update(key, value)
            self.cm_config.write(output="yaml")
            Console.color = False
            print("color off.")
        else:
            print("Color:", Console.color)
            Console.warning("Warning")
            Console.error("Error")
            Console.info("Info")
            Console.msg("Msg")
            Console.ok("Success")
Exemplo n.º 2
0
    def do_color(self, args, arguments):
        """
        ::
        
          Usage:
              color on
              color off
              color

              Turns the shell color printing on or off

          Description:

              color on   switched the color on

              color off  switches the color off

              color      without parameters prints a test to display
                         the various colored mesages. It is intended
                         as a test to see if your terminal supports
                         colors.

        """
        if arguments['on']:
            key = "cloudmesh.shell.color"
            value = True
            self.cm_config._update(key, value)
            self.cm_config.write(output="yaml")
            Console.color = True
            print ("color on.")
        elif arguments['off']:
            key = "cloudmesh.shell.color"
            value = False
            self.cm_config._update(key, value)
            self.cm_config.write(output="yaml")
            Console.color = False
            print ("color off.")
        else:
            print("Color:", Console.color)
            Console.warning("Warning")
            Console.error("Error")
            Console.info("Info")
            Console.msg("Msg")
            Console.ok("Success")
Exemplo n.º 3
0
 def print_error(kind, path):
     if verbose:
         Console.error("the {0} {1} already exists".format(kind, path))
         Console.msg("")
         Console.msg("If you like to reinstall it, "
                     "please remove the file first")
         Console.msg("")
Exemplo n.º 4
0
    def do_admin(self, args, arguments):
        """
        ::

          Usage:
            admin password reset
            admin password

          Options:


          Description:
            admin password reset
              Reset portal password

        """
        pprint(arguments)

        if arguments['password'] and arguments['reset']:
            Console.ok('password reset ...')

            self.password = getpass("Password:"******"~/.cloudmesh/cmd3.yaml")
            config = ConfigDict(filename=filename)
            config["cmd3"]["properties"]["password"] = self.password
            config.write(filename=filename, output="yaml")
            Console.ok("Resetting password. ok.")

        elif arguments['password']:

            if yn_choice("Would you like to print the password?"):
                filename = path_expand("~/.cloudmesh/cmd3.yaml")
                config = ConfigDict(filename=filename)
                try:
                    self.password = config["cmd3"]["properties"]["password"]
                except Exception:
                    Console.error("could not find the password. Please set it.")
                    return
                Console.msg("Password: {:}".format(self.password))
Exemplo n.º 5
0
    def do_admin(self, args, arguments):
        """
        ::

          Usage:
            admin password reset
            admin password

          Options:


          Description:
            admin password reset
              Reset portal password

        """
        pprint(arguments)

        if arguments["password"] and arguments["reset"]:
            Console.ok("password reset ...")

            self.password = getpass("Password:"******"~/.cloudmesh/cmd3.yaml")
            config = ConfigDict(filename=filename)
            config["cmd3"]["properties"]["password"] = self.password
            config.write(filename=filename, output="yaml")
            Console.ok("Resetting password. ok.")

        elif arguments["password"]:

            if yn_choice("Would you like to print the password?"):
                filename = path_expand("~/.cloudmesh/cmd3.yaml")
                config = ConfigDict(filename=filename)
                try:
                    self.password = config["cmd3"]["properties"]["password"]
                except Exception:
                    Console.error("could not find the password. Please set it.")
                    return
                Console.msg("Password: {:}".format(self.password))