Repository navigation
Add --organization_name to upload to an organization by a saved name - #932
Merged
Merged
Conversation
Uploading to an organization needs its ID in --organization_key on every
run. Let users save a name for it in the user profile, the way --user_name
names a profile, and upload to it by that name:
- --organization_key ID --organization_name NAME checks the ID, saves
NAME = ID in the profile and uploads to it. A name saved with another
ID is replaced, with a warning.
- --organization_name NAME alone uploads to the ID saved under NAME,
checked with fetch_organization as --organization_key is. An unknown
name lists the profile's saved names and fails.
- Names follow the profile name rules, so a name is never taken for an
ID, and --organization_key takes only digits.
- authenticate lists the names saved in each profile, and deletes one
with --organization_name NAME --delete, without logging in.
The public Graph API can't look an organization up by name, so the names
are saved locally, one line per name in the profile's section
("MAPOrganization.work = 1234567890"). They are never written into
MAPOrganizationKey, which sends every upload of the profile to that
organization.
The config can now be written during an upload while another process
reads it, so it is written to a temporary file in the same folder and
moved over the old one. Where that fails (a folder without write
permission, a config file mounted into a container, or on Windows a
config another process has open), it is written in place as before. A
symlinked config stays a link, and the config keeps its file mode.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uploading to an organization needs its ID in
--organization_keyon every run. This lets users save a name for it in the user profile, the way--user_namenames a profile:The public Graph API can't look an organization up by name or list a user's organizations, so the names are saved locally.
--organization_nameworks withupload,process_and_uploadandvideo_process_and_upload. The saved ID is checked withfetch_organizationon every upload, as--organization_keyis.-and_), so a name is never taken for an ID. They are case-sensitive.--organization_keywith anything but digits fails and points to--organization_name.--organization_key IDalone works as before and saves nothing. It now logs a one-line hint.authenticatelists each profile's saved names under it.authenticate --user_name me --organization_name work --deletedeletes only that name, without logging in.Storage: one line per name in the profile's section, e.g.
MAPOrganization.work = 1234567890. Names are never written intoMAPOrganizationKey, which sends every upload of the profile to that organization. That key works as before, and--organization_nameoverrides it for one upload. v0.14.7 reads a config with saved names, uploads with it (to no organization), and keeps the names when it re-authenticates.Config writes: the config is now written during uploads, which may run at once. So it is written to a temporary file in the same folder and moved over the old one, and a reader never sees it half written. If that fails, it is written in place as before. That happens for a folder without write permission, a config file mounted into a container, or on Windows a config another process has open. A symlinked config stays a link, and the file keeps its mode (a new config is created readable by its owner only).
Known limits:
authenticateruns already have the same race.--organization_keyshorter than--organization_k(e.g.--organization) are now ambiguous.Tests:
fetch_organizationmocked: saving then using in a fresh config, through each upload command and into the upload history; theMAPOrganizationKeydefault; re-authenticating; logging in first when there is no profile; the profile prompt; listing and deleting; the name rules; the config writes (symlink, file mode, read-only folder, fallback, failed write).