-
Notifications
You must be signed in to change notification settings - Fork 851
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use key manager merger into DEV #2985
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c257be6
Initial work on key manager
Ulincsys 87bd311
implement remaining functionality
Ulincsys ed050d7
Add test and improve consistency
Ulincsys 74c40f9
Merge branch 'dev' into key-manager
Ulincsys 7ed6460
Add startup entrypoints for orchestrator
Ulincsys 9110b4e
Merge branch 'dev' into key-manager
Ulincsys 93039e4
start using new key manager
ABrain7710 387ab23
expire actually returns a key!
ABrain7710 8748fb0
remove no gitlab keys exception
ABrain7710 e13f66c
Add debug logs
Ulincsys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,8 @@ | |
|
||
from augur.tasks.start_tasks import augur_collection_monitor, create_collection_status_records | ||
from augur.tasks.git.facade_tasks import clone_repos | ||
from augur.tasks.github.util.github_api_key_handler import GithubApiKeyHandler | ||
from augur.tasks.gitlab.gitlab_api_key_handler import GitlabApiKeyHandler | ||
from augur.tasks.data_analysis.contributor_breadth_worker.contributor_breadth_worker import contributor_breadth_model | ||
from augur.application.db.models import UserRepo | ||
from augur.application.db.session import DatabaseSession | ||
|
@@ -25,6 +27,8 @@ | |
from augur.application.cli import test_connection, test_db_connection, with_database, DatabaseContext | ||
from augur.application.cli._cli_util import _broadcast_signal_to_processes, raise_open_file_limit, clear_redis_caches, clear_rabbitmq_messages | ||
|
||
from keyman.KeyClient import KeyClient, KeyPublisher | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [pylint] reported by reviewdog 🐶 |
||
|
||
logger = AugurLogger("augur", reset_logfiles=False).get_logger() | ||
|
||
@click.group('server', short_help='Commands for controlling the backend API server & data collection workers') | ||
|
@@ -51,6 +55,26 @@ def start(ctx, development): | |
logger.error("Failed to raise open file limit!") | ||
raise e | ||
|
||
keypub = KeyPublisher() | ||
|
||
orchestrator = subprocess.Popen("python keyman/Orchestrator.py".split()) | ||
|
||
# Wait for orchestrator startup | ||
if not keypub.wait(republish=True): | ||
logger.critical("Key orchestrator did not respond in time") | ||
return | ||
|
||
# load keys | ||
ghkeyman = GithubApiKeyHandler(logger) | ||
glkeyman = GitlabApiKeyHandler(logger) | ||
|
||
for key in ghkeyman.keys: | ||
keypub.publish(key, "github_rest") | ||
keypub.publish(key, "github_graphql") | ||
|
||
for key in glkeyman.keys: | ||
keypub.publish(key, "gitlab_rest") | ||
|
||
if development: | ||
os.environ["AUGUR_DEV"] = "1" | ||
logger.info("Starting in development mode") | ||
|
@@ -94,6 +118,8 @@ def start(ctx, development): | |
if p: | ||
p.terminate() | ||
|
||
keypub.shutdown() | ||
|
||
if celery_beat_process: | ||
logger.info("Shutting down celery beat process") | ||
celery_beat_process.terminate() | ||
|
This file contains 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
This file contains 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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[pylint] reported by reviewdog 🐶
W0611: Unused KeyClient imported from keyman.KeyClient (unused-import)