예제 #1
0
파일: license.py 프로젝트: sunuslee/ocsetup
    def form(self):
        log("enter license form function....")
        remaindays = 0
        try:
            hasregister = hasRegistered()
            hasstart = hasStarted()

            headermessage = WidgetBase("Basic_Information", "Label", "Basic Information",
                    title=True)

            #show hypervisor version information
            version = getVersionInfo()
            versionlabel =  WidgetBase("Version", "Label",
                    "Version:" + version)

            #show register information
            subtopiclabel = WidgetBase("SUB_TOPIC_LABEL", "Label",
                    "Basic Register Information: ", title=True)

            maclabel = WidgetBase("MAC_LABEL", "Label", "",
                    get_conf=lambda : "MAC :  " +
                    getLicenseConfig("vars", "mac", "F0:DE:F1:00:00:00"))

            sysuuidlabel = WidgetBase("SYSTEMUUID_LABEL", "Label", "",
                    get_conf=lambda : "UUID :  " +
                    getLicenseConfig("vars", "systemuuid", "00000000-0000-0000-0000-000000000000"))

            if hasstart and hasregister:
                taillabel_text = "Your hypervisor has been registered successfully.Any question, please contact : [email protected]!"
            else:
                days, issuccess = computeDeprecatedDays()
                if issuccess:
                    log("the day is %d" % days)
                    remaindays = DEFAULTREMAININGDAYS - days
                    if remaindays < 0:
                        remaindays = 0
                else:
                    log("Failed to invoke computeDeprecatedDays. ")
                warninginfo = "You have " + str(remaindays) + " to use before registering."
                taillabel_text = "Your hypervisor hasn't been registered.Please use the information above to register."+warninginfo
            note = WidgetBase("note", "Label", "Note:", title=True)
            taillabel = WidgetBase("TAIL_LABEL", "Label", taillabel_text, width=80)
        except:
            log("Here some error happened.format ext:  %s " % traceback.format_exc())

        return [ "License", "License",
                    [
                        (headermessage,),
                        (versionlabel,),
                        (subtopiclabel,),
                        (maclabel,),
                        (sysuuidlabel,),
                        (note,),
                        (taillabel,),
                        (EMPTY_LINE,),
                    ]
              ]
예제 #2
0
파일: imvp.py 프로젝트: sunuslee/ocsetup
 def _getHeaderInfo(self):
     self.registered = hasRegistered()
     self.started = hasStarted()
     self.deprecated = hasDeprecated()
     self.is_network_up = network_up()
     if self.is_network_up:
         header_message = "IMVP Configuration"
         if self.started and not self.registered:
             header_message += " (Network Up, but Not Registered)"
     else:
         header_message = "Network Down, IMVP Configuration Disabled"
     return header_message
예제 #3
0
파일: imvp.py 프로젝트: jarod-w/ocsetup
 def _getHeaderInfo(self):
     self.registered = hasRegistered()
     self.started = hasStarted()
     self.deprecated = hasDeprecated()
     self.is_network_up = network_up()
     if self.is_network_up:
         header_message = "IMVP Configuration"
         if self.started and not self.registered:
             header_message += " (Network Up, but Not Registered)"
     else:
         header_message = "Network Down, IMVP Configuration Disabled"
     return header_message
예제 #4
0
    def form(self):
        log("enter license form function....")
        remaindays = 0
        try:
            hasregister = hasRegistered()
            hasstart = hasStarted()

            headermessage = WidgetBase("Basic_Information",
                                       "Label",
                                       "Basic Information",
                                       title=True)

            #show hypervisor version information
            version = getVersionInfo()
            versionlabel = WidgetBase("Version", "Label", "Version:" + version)

            #show register information
            subtopiclabel = WidgetBase("SUB_TOPIC_LABEL",
                                       "Label",
                                       "Basic Register Information: ",
                                       title=True)

            maclabel = WidgetBase(
                "MAC_LABEL",
                "Label",
                "",
                get_conf=lambda: "MAC :  " + getLicenseConfig(
                    "vars", "mac", "F0:DE:F1:00:00:00"))

            sysuuidlabel = WidgetBase(
                "SYSTEMUUID_LABEL",
                "Label",
                "",
                get_conf=lambda: "UUID :  " + getLicenseConfig(
                    "vars", "systemuuid",
                    "00000000-0000-0000-0000-000000000000"))

            if hasstart and hasregister:
                taillabel_text = "Your hypervisor has been registered successfully.Any question, please contact : [email protected]!"
            else:
                days, issuccess = computeDeprecatedDays()
                if issuccess:
                    log("the day is %d" % days)
                    remaindays = DEFAULTREMAININGDAYS - days
                    if remaindays < 0:
                        remaindays = 0
                else:
                    log("Failed to invoke computeDeprecatedDays. ")
                warninginfo = "You have " + str(
                    remaindays) + " to use before registering."
                taillabel_text = "Your hypervisor hasn't been registered.Please use the information above to register." + warninginfo
            note = WidgetBase("note", "Label", "Note:", title=True)
            taillabel = WidgetBase("TAIL_LABEL",
                                   "Label",
                                   taillabel_text,
                                   width=80)
        except:
            log("Here some error happened.format ext:  %s " %
                traceback.format_exc())

        return [
            "License", "License",
            [
                (headermessage, ),
                (versionlabel, ),
                (subtopiclabel, ),
                (maclabel, ),
                (sysuuidlabel, ),
                (note, ),
                (taillabel, ),
                (EMPTY_LINE, ),
            ]
        ]