Beispiel #1
0
class CheckBoxConfig(PlainBoxConfig):
    """
    Configuration for checkbox-ng
    """

    secure_id = config.Variable(
        section="sru",
        help_text="Secure ID of the system",
        validator_list=[
            config.PatternValidator(r"^[a-zA-Z0-9]{15}$|^[a-zA-Z0-9]{18}$")
        ])

    # TODO: Add a validator to check if URL looks fine
    c3_url = config.Variable(
        section="sru",
        help_text="URL of the certification website",
        default="https://certification.canonical.com/submissions/submit/")

    fallback_file = config.Variable(section="sru",
                                    help_text="Location of the fallback file")

    whitelist = config.Variable(
        section="sru",
        help_text="Optional whitelist with which to run SRU testing")

    class Meta(PlainBoxConfig.Meta):
        # TODO: properly depend on xdg and use real code that also handles
        # XDG_CONFIG_HOME.
        #
        # NOTE: filename_list is composed of checkbox and plainbox variables,
        # mixed so that:
        # - checkbox takes precedence over plainbox
        # - ~/.config takes precedence over /etc
        filename_list = list(
            itertools.chain(*zip(PlainBoxConfig.Meta.filename_list, (
                '/etc/xdg/checkbox.conf',
                os.path.expanduser('~/.config/checkbox.conf')))))
Beispiel #2
0
class LauncherDefinitionLegacy(LauncherDefinition):
    """
    Launcher definition class for 'unversioned' launchers.

    This definition is used for launchers that do not specify
    'launcher_version' in their [launcher] section.
    """

    api_flags = config.Variable(
        section='launcher',
        kind=list,
        default=[],
        help_text=_('List of feature-flags the application requires'))

    api_version = config.Variable(
        section='launcher',
        default='0.99',
        help_text=_('Version of API the launcher uses'))

    title = config.Variable(
        section="welcome",
        help_text=_("Application Title"))

    text = config.Variable(
        section="welcome",
        help_text=_("Welcome Message"))

    dont_suppress_output = config.Variable(
        section="ui", kind=bool, default=False,
        help_text=_("Don't suppress the output of certain job plugin types."))

    whitelist_filter = config.Variable(
        section="suite",
        # TODO: valid regexp text validator
        help_text=_("Pattern that whitelists need to match to be displayed"))

    whitelist_selection = config.Variable(
        section="suite",
        # TODO: valid regexp text validator
        help_text=_("Pattern that whitelists need to match to be selected"))

    skip_whitelist_selection = config.Variable(
        section="suite",
        kind=bool,
        default=False,
        help_text=_("If enabled then suite selection screen is not displayed"))

    skip_test_selection = config.Variable(
        section="suite",
        kind=bool,
        default=False,
        help_text=_("If enabled then test selection screen is not displayed"))

    input_type = config.Variable(
        section="submission",
        # TODO: probably a choice validator
        help_text=_("Type of the input field?"))

    ok_btn_text = config.Variable(
        section="submission",
        help_text=_("Label on the 'send' button"))

    submit_to_hexr = config.Variable(
        section="submission",
        kind=bool,
        # TODO: default?
        help_text=_("If enabled then test results will be also sent to HEXR"))

    submit_to = config.Variable(
        section="transport",
        validator_list=[config.ChoiceValidator(get_all_transports().keys())],
        help_text=_("Where to submit the test results to"))

    # TODO: Add a validator to ensure it looks like a valid URL
    submit_url = config.Variable(
        section="transport",
        help_text=_("HTTP endpoint to submit data to, using the"
                    " transport specified with submit_to."))

    secure_id = config.Variable(
        section="submission",
        validator_list=[config.PatternValidator(SECURE_ID_PATTERN)],
        help_text=_("Secure ID to identify the system this"
                    " submission belongs to."))

    exporter = config.Section(
        help_text=_("Section with only exported unit ids as keys (no values)"))
Beispiel #3
0
class CheckBoxConfig(PlainBoxConfig):
    """
    Configuration for checkbox-ng
    """

    secure_id = config.Variable(
        section="sru",
        help_text=_("Secure ID of the system"),
        validator_list=[config.PatternValidator(SECURE_ID_PATTERN)])

    submit_to_c3 = config.Variable(
        section="submission",
        help_text=_("Whether to send the submission data to c3"))

    submit_to_hexr = config.Variable(
        section="submission",
        help_text=_("Whether to also send the submission data to HEXR"),
        kind=bool)

    # TODO: Add a validator to check if email looks fine
    email_address = config.Variable(
        section="sru",
        help_text=_("Email address to log into the Launchpad HWDB"))

    # TODO: Add a validator to check if URL looks fine
    c3_url = config.Variable(
        section="sru",
        help_text=_("URL of the certification website"),
        default="https://certification.canonical.com/submissions/submit/")

    # TODO: Add a validator to check if URL looks fine
    lp_url = config.Variable(
        section="sru",
        help_text=_("URL of the launchpad hardware database"),
        default="https://launchpad.net/+hwdb/+submit")

    fallback_file = config.Variable(
        section="sru",
        help_text=_("Location of the fallback file"))

    whitelist = config.Variable(
        section="sru",
        help_text=_("Optional whitelist with which to run SRU testing"))

    test_plan = config.Variable(
        section="sru",
        help_text=_("Optional test plan with which to run SRU testing"))

    staging = config.Variable(
        section="sru",
        kind=bool,
        default=False,
        help_text=_("Send the data to non-production test server"))

    class Meta(PlainBoxConfig.Meta):
        # TODO: properly depend on xdg and use real code that also handles
        # XDG_CONFIG_HOME.
        #
        # NOTE: filename_list is composed of checkbox and plainbox variables,
        # mixed so that:
        # - checkbox takes precedence over plainbox
        # - ~/.config takes precedence over /etc
        filename_list = list(
            itertools.chain(
                *zip(
                    PlainBoxConfig.Meta.filename_list, (
                        '/etc/xdg/checkbox.conf',
                        os.path.expanduser('~/.config/checkbox.conf')))))
Beispiel #4
0
class LauncherDefinition(config.Config):
    """
    Launcher definition.

    Launchers are small executables using one of the available user interfaces
    as the interpreter. This class contains all the available options that can
    be set inside the launcher, that will affect the user interface at runtime.
    """

    title = config.Variable(section="welcome",
                            help_text=_("Application Title"))

    text = config.Variable(section="welcome", help_text=_("Welcome Message"))

    whitelist_filter = config.Variable(
        section="suite",
        # TODO: valid regexp text validator
        help_text=_("Pattern that whitelists need to match to be displayed"))

    whitelist_selection = config.Variable(
        section="suite",
        # TODO: valid regexp text validator
        help_text=_("Pattern that whitelists need to match to be selected"))

    skip_whitelist_selection = config.Variable(
        section="suite",
        kind=bool,
        default=False,
        help_text=_("If enabled then suite selection screen is not displayed"))

    skip_test_selection = config.Variable(
        section="suite",
        kind=bool,
        default=False,
        help_text=_("If enabled then test selection screen is not displayed"))

    input_type = config.Variable(
        section="submission",
        # TODO: probably a choice validator
        help_text=_("Type of the input field?"))

    ok_btn_text = config.Variable(section="submission",
                                  help_text=_("Label on the 'send' button"))

    submit_to_hexr = config.Variable(
        section="submission",
        kind=bool,
        # TODO: default?
        help_text=_("If enabled then test results will be also sent to HEXR"))

    submit_to = config.Variable(
        section="transport",
        validator_list=[config.ChoiceValidator(get_all_transports().keys())],
        help_text=_("Where to submit the test results to"))

    # TODO: Add a validator to ensure it looks like a valid URL
    submit_url = config.Variable(
        section="transport",
        help_text=_("HTTP endpoint to submit data to, using the"
                    " transport specified with submit_to."))

    secure_id = config.Variable(
        section="submission",
        validator_list=[config.PatternValidator(SECURE_ID_PATTERN)],
        help_text=_("Secure ID to identify the system this"
                    " submission belongs to."))

    config_filename = config.Variable(
        section="config", help_text=_("Name of custom configuration file"))

    dont_suppress_output = config.Variable(
        section="ui",
        kind=bool,
        default=False,
        help_text=_("Don't suppress the output of certain job plugin types."))

    exporter = config.Section(
        help_text=_("Section with only exported unit ids as keys (no values)"))