Skip to content
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 ruff errors #173

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions bin/pixldc
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""A wrapper around docker compose that sets the correct directory and environment"""
import argparse
import logging
import os
from pathlib import Path

# A wrapper around docker compose that sets the correct directory and environment
ALLOWED_PROJECT_NAMES = ["pixl_dev", "pixl_test", "pixl_prod"]
parser = argparse.ArgumentParser(description="Wrapper around docker compose for pixl")
parser.add_argument(
Expand All @@ -29,10 +31,13 @@ parser.add_argument(
parser.add_argument("command", help="Which docker compose command to run")
args, unknown_args = parser.parse_known_args()

BIN_DIR = os.path.dirname(__file__)
if args.debug:
logging.basicConfig(level=logging.DEBUG)

BIN_DIR = Path(__file__).parent.absolute()
os.chdir(BIN_DIR)
PROJECT_DIR = os.path.dirname(BIN_DIR)
COMPOSE_FILE = os.path.join(PROJECT_DIR, "docker-compose.yml")
PROJECT_DIR = BIN_DIR.parent.absolute()
COMPOSE_FILE = PROJECT_DIR / "docker-compose.yml"

# The first arg is necessary even if it looks repetitive! Equivalent to bash's $0.
docker_args = [
Expand All @@ -52,9 +57,8 @@ if args.command == "up":
# add on the user's extra args
docker_args.extend(unknown_args)

if args.debug:
print(f"args = {args}")
print(f"extra args = {unknown_args}")
print(f"about to run with docker: {docker_args}")
logging.debug("args = %s", args)
logging.debug("extra args = %s", unknown_args)
logging.debug("about to run with docker: %s", docker_args)

os.execvp("docker", docker_args)
os.execvp("docker", docker_args) # noqa: S606, S607 this is what the previous script was doing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed, as we're not handing back to anything after the processing this seems like a reasonable excemption