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
Fix Install Chmod Issue as Well as SQL Syntax #2737
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
# SPDX-License-Identifier: MIT | ||
import os | ||
from os import environ, chmod, path, getenv, stat | ||
import logging | ||
from sys import exit | ||
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 🐶 |
||
|
@@ -11,6 +12,7 @@ | |
import pandas as pd | ||
import json | ||
import re | ||
import stat | ||
IsaacMilarky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
from augur.application.cli import test_connection, test_db_connection, with_database, DatabaseContext | ||
|
||
|
@@ -41,14 +43,14 @@ | |
NOTE: The Group ID must already exist in the REPO_Groups Table. | ||
|
||
If you want to add an entire GitHub organization, refer to the command: augur db add-github-org""" | ||
from augur.tasks.github.util.github_task_session import GithubTaskSession | ||
Check warning on line 46 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
from augur.util.repo_load_controller import RepoLoadController | ||
Check warning on line 47 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
|
||
with GithubTaskSession(logger, engine=ctx.obj.engine) as session: | ||
|
||
controller = RepoLoadController(session) | ||
|
||
with open(filename) as upload_repos_file: | ||
Check warning on line 53 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
data = csv.reader(upload_repos_file, delimiter=",") | ||
for row in data: | ||
|
||
|
@@ -112,7 +114,7 @@ | |
""" | ||
) | ||
|
||
with open(filename) as create_repo_groups_file: | ||
Check warning on line 117 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
data = csv.reader(create_repo_groups_file, delimiter=",") | ||
for row in data: | ||
|
||
|
@@ -145,8 +147,8 @@ | |
""" | ||
Create new repo groups in Augur's database | ||
""" | ||
from augur.tasks.github.util.github_task_session import GithubTaskSession | ||
Check warning on line 150 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
from augur.util.repo_load_controller import RepoLoadController | ||
Check warning on line 151 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
|
||
with GithubTaskSession(logger, engine=ctx.obj.engine) as session: | ||
|
||
|
@@ -303,7 +305,7 @@ | |
|
||
|
||
else: | ||
with open("db.config.json", "r") as f: | ||
Check warning on line 308 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
config = json.load(f) | ||
print(f"Config: {config}") | ||
check_pgpass_credentials(config) | ||
|
@@ -343,7 +345,7 @@ | |
} | ||
} | ||
check_pgpass_credentials(config) | ||
run_db_creation_psql_command( | ||
Check warning on line 348 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
host, port, default_user, default_db_name, f"CREATE DATABASE {target_db_name};" | ||
) | ||
run_db_creation_psql_command( | ||
|
@@ -391,7 +393,7 @@ | |
print("Successful db connection") | ||
|
||
|
||
# TODO: Fix this function | ||
def run_psql_command_in_database(target_type, target): | ||
if target_type not in ["-f", "-c"]: | ||
logger.error("Invalid target type. Exiting...") | ||
|
@@ -404,7 +406,7 @@ | |
|
||
if augur_db_environment_var: | ||
pass | ||
#TODO: Add functionality for environment variable | ||
Check warning on line 409 in augur/application/cli/db.py GitHub Actions / runner / pylint
|
||
else: | ||
with open("db.config.json", 'r') as f: | ||
db_config = json.load(f) | ||
|
@@ -443,7 +445,7 @@ | |
open(pgpass_file_path, "w+") | ||
IsaacMilarky marked this conversation as resolved.
Show resolved
Hide resolved
IsaacMilarky marked this conversation as resolved.
Show resolved
Hide resolved
|
||
chmod(pgpass_file_path, stat.S_IWRITE | stat.S_IREAD) | ||
|
||
pgpass_file_mask = oct(stat(pgpass_file_path).st_mode & 0o777) | ||
pgpass_file_mask = oct(os.stat(pgpass_file_path).st_mode & 0o777) | ||
|
||
if pgpass_file_mask != "0o600": | ||
print("Updating ~/.pgpass file permissions.") | ||
|
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 🐶
C0114: Missing module docstring (missing-module-docstring)