saltext.github.utils.gh.profile¶
Resolution of Salt profile configuration into GitHub connections,
shared between the github, github_org and github_repo
execution modules as well as the github resource type.
Profiles are resolved directly from opts, mirroring config.get’s
lookup order: minion configuration, then grains, then pillar, then
master configuration (which reaches the minion via the master’s
pillar_opts setting, rendered under pillar["master"]). SDB URIs
in profile values are rendered on access, like config.get renders
them. config.get itself cannot serve as the backend since it is
unavailable to parts of the resource subsystem (type discovery runs
before the minion’s module loader exists).
- saltext.github.utils.gh.profile.get_config_value(profile, config_name, *, opts, context=None, utils=None, default=<object object>)[source]¶
Return a profile’s configuration value based on the supplied configuration name. See the module docstring for the lookup order and SDB handling; the first scope carrying the requested value wins.
- profile
Profile name that contains configuration information.
- config_name
Configuration item name to look up.
- opts
The minion configuration (
__opts__).- context
Pass
__context__to cache rendered values, saving repeated SDB lookups.- utils
Pass
__utils__when available to avoid building a fresh utils loader for SDB rendering.- default
Value to return when the profile does not carry the item. Without it, a missing item raises a
CommandExecutionError.
- saltext.github.utils.gh.profile.get_api_url(profile, *, opts, context=None, utils=None)[source]¶
Return the configured GitHub API base URL, defaulting to the public one.
- profile
Profile name that contains configuration information.
- opts
The minion configuration (
__opts__).- context
Pass
__context__to cache rendered values.- utils
Pass
__utils__when available (SDB rendering).
- saltext.github.utils.gh.profile.get_owner(profile, *, opts, context=None, utils=None)[source]¶
Return the configured default repository owner: the profile’s
owner, falling back to the legacyorg_namealias. ReturnsNonewhen neither is set, making the connection default to the token’s user.- profile
Profile name that contains configuration information.
- opts
The minion configuration (
__opts__).- context
Pass
__context__to cache rendered values.- utils
Pass
__utils__when available (SDB rendering).
- saltext.github.utils.gh.profile.get_conn(profile, *, opts, context, utils=None)[source]¶
Return a
GitHubConnectionfor a profile, cached incontextfor performance.Unless the profile disables it (
cache), the connection carries aPersistentCachefor slow-changing API data, surviving across processes.- profile
Profile name that contains configuration information.
- opts
The minion configuration (
__opts__).- context
Pass
__context__. Caches the connection and rendered profile values.- utils
Pass
__utils__when available (SDB rendering).
- saltext.github.utils.gh.profile.resource_decl(opts)[source]¶
Return the
githubresource type’s declaration from the resource pillar subtree ({}when unset or not a mapping).- opts
The minion configuration (
__opts__).
- saltext.github.utils.gh.profile.resource_profile(opts)[source]¶
Return the default profile name configured in the
githubresource declaration, defaulting togithub.- opts
The minion configuration (
__opts__).
- saltext.github.utils.gh.profile.resource_owners(opts)[source]¶
Return the owners named in the
githubresource declaration as a list (an empty one when unset). The declaration’sownersmay be a plain list of owner names or a mapping of owner name to per-owner settings (profile,repos,exclude,include_archived).- opts
The minion configuration (
__opts__).
- saltext.github.utils.gh.profile.resource_owner_setting(opts, owner, key, default=None)[source]¶
Return a declaration setting for one owner: the owner’s own value from the
ownersmapping when set, otherwise the declaration-level value, otherwisedefault.- opts
The minion configuration (
__opts__).- owner
Owner (organization or user) login.
- key
Setting name (
profile,repos,exclude,include_archived).- default
Value to return when neither the owner nor the declaration carries the setting.
- saltext.github.utils.gh.profile.resource_owner_profile(opts, owner)[source]¶
Return the profile name to use for one owner’s repositories: the owner’s
profileoverride from the declaration’sownersmapping when present, otherwise the declaration’s default profile. Owner names are matched case-insensitively.- opts
The minion configuration (
__opts__).- owner
Owner (organization or user) login.
- saltext.github.utils.gh.profile.resource_profiles(opts)[source]¶
Return all distinct profile names referenced by the
githubresource declaration: the default one plus any per-owner overrides.- opts
The minion configuration (
__opts__).
- saltext.github.utils.gh.profile.resource_conn(opts, context, *, profile=None, owner=None, utils=None)[source]¶
Return the
GitHubConnectionfor agithubresource context, resolved fromopts.- opts
The minion configuration (
__opts__).- context
Cache mapping for the connection (
__context__).- profile
Profile name override. When unset, the profile is resolved from the resource declaration: the targeted
owner’s override when declared, otherwise the declaration’s default profile (githubwhen unset).- owner
Owner the connection is for, used to resolve per-owner profile overrides. Ignored when
profileis passed.- utils
Pass
__utils__when available (SDB rendering).