Skip to content

Commit

Permalink
Merge pull request #82 from cisagov/improvement/get-rid-of-deprecatio…
Browse files Browse the repository at this point in the history
…n-warnings

Get rid of deprecation warnings
  • Loading branch information
jsf9k authored Feb 9, 2024
2 parents 40f4de9 + ad7edf6 commit 2896383
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 28 deletions.
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ RUN pip3 install --no-cache-dir --upgrade \
# Install Python dependencies
###
RUN pip3 install --no-cache-dir --upgrade \
https://github.com/cisagov/mongo-db-from-config/tarball/develop \
pytz
https://github.com/cisagov/mongo-db-from-config/tarball/develop

###
# Put this just before we change users because the copy (and every
Expand Down
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ expects the secrets in a different location.
To run the `cisagov/saver` image via Docker:

```console
docker run cisagov/saver:1.3.4
docker run cisagov/saver:1.3.5
```

### Running with Docker Compose ###
Expand All @@ -46,7 +46,7 @@ docker run cisagov/saver:1.3.4

services:
saver:
image: cisagov/saver:1.3.4
image: cisagov/saver:1.3.5
volumes:
- type: bind
source: <your_log_dir>
Expand Down Expand Up @@ -92,7 +92,7 @@ environment variables. See the
services:
trustymail_reporter:
image: cisagov/saver:1.3.4
image: cisagov/saver:1.3.5
volumes:
- type: bind
source: <your_log_dir>
Expand Down Expand Up @@ -129,7 +129,7 @@ environment variables. See the
1. Pull the new image:

```console
docker pull cisagov/saver:1.3.4
docker pull cisagov/saver:1.3.5
```

1. Recreate and run the container by following the [previous instructions](#running-with-docker).
Expand All @@ -139,11 +139,11 @@ environment variables. See the
The images of this container are tagged with [semantic
versions](https://semver.org) of the underlying saver project that they
containerize. It is recommended that most users use a version tag (e.g.
`:1.3.4`).
`:1.3.5`).

| Image:tag | Description |
|-----------|-------------|
|`cisagov/saver:1.3.4`| An exact release version. |
|`cisagov/saver:1.3.5`| An exact release version. |
|`cisagov/saver:1.3`| The most recent release matching the major and minor version numbers. |
|`cisagov/saver:1`| The most recent release matching the major version number. |
|`cisagov/saver:edge` | The most recent image built from a merge into the `develop` branch of this repository. |
Expand Down Expand Up @@ -206,8 +206,8 @@ Build the image locally using this git repository as the [build context](https:/

```console
docker build \
--build-arg VERSION=1.3.4 \
--tag cisagov/saver:1.3.4 \
--build-arg VERSION=1.3.5 \
--tag cisagov/saver:1.3.5 \
https://github.com/cisagov/saver.git#develop
```

Expand Down Expand Up @@ -237,9 +237,9 @@ Docker:
docker buildx build \
--file Dockerfile-x \
--platform linux/amd64 \
--build-arg VERSION=1.3.4 \
--build-arg VERSION=1.3.5 \
--output type=docker \
--tag cisagov/saver:1.3.4 .
--tag cisagov/saver:1.3.5 .
```

## Contributing ##
Expand Down
4 changes: 2 additions & 2 deletions src/create_sld_to_agency_name_and_id_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Standard Python Libraries
import csv
import datetime
from datetime import datetime, timezone
import os

# Third-Party Libraries
Expand Down Expand Up @@ -63,7 +63,7 @@ def main():
# Mongo 4 we can use a transaction to atomically (1) drop all the
# rows from the collection and (2) use insert_many() to insert all
# the new data. That will be much cleaner!
now = datetime.datetime.utcnow()
now = datetime.now(timezone.utc)
with open(CURRENT_FEDERAL_FILE, newline="") as current_federal_file:
csvreader = csv.DictReader(current_federal_file)
for row in csvreader:
Expand Down
6 changes: 2 additions & 4 deletions src/pshtt_csv2mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Standard Python Libraries
import csv
import datetime
from datetime import datetime, time, timezone
import os
import re

Expand Down Expand Up @@ -103,9 +103,7 @@ def store_data(clean_federal, agency_dict, db_config_file):
:param db_config_file: The name of the file where the database
configuration is stored
"""
date_today = datetime.datetime.combine(
datetime.datetime.utcnow(), datetime.time.min
)
date_today = datetime.combine(datetime.now(timezone.utc), time.min)
db = db_from_config(db_config_file) # set up database connection
f = open(PSHTT_RESULTS_FILE)
csv_f = csv.DictReader(f)
Expand Down
7 changes: 2 additions & 5 deletions src/sslyze_csv2mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

# Standard Python Libraries
import csv
import datetime
from datetime import datetime, time, timezone
import os

# Third-Party Libraries
from mongo_db_from_config import db_from_config
from pytz import timezone

DB_CONFIG_FILE = "/run/secrets/scan_write_creds.yml"
HOME_DIR = os.environ.get("CISA_HOME")
Expand Down Expand Up @@ -103,9 +102,7 @@ def store_data(clean_federal, agency_dict, db_config_file):
:param db_config_file: The name of the file where the database
configuration is stored
"""
date_today = datetime.datetime.combine(
datetime.datetime.utcnow(), datetime.time.min
)
date_today = datetime.combine(datetime.now(timezone.utc), time.min)
db = db_from_config(db_config_file) # set up database connection
f = open(SSLYZE_RESULTS_FILE)
csv_f = csv.DictReader(f)
Expand Down
6 changes: 2 additions & 4 deletions src/trustymail_csv2mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

# Standard Python Libraries
import csv
import datetime
from datetime import datetime, time, timezone
import os

# Third-Party Libraries
Expand Down Expand Up @@ -101,9 +101,7 @@ def store_data(clean_federal, agency_dict, db_config_file):
:param db_config_file: The name of the file where the database
configuration is stored
"""
date_today = datetime.datetime.combine(
datetime.datetime.utcnow(), datetime.time.min
)
date_today = datetime.combine(datetime.now(timezone.utc), time.min)
db = db_from_config(db_config_file) # set up database connection
f = open(TRUSTYMAIL_RESULTS_FILE)
csv_f = csv.DictReader(f)
Expand Down
2 changes: 1 addition & 1 deletion src/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.3.4"
__version__ = "1.3.5"

0 comments on commit 2896383

Please sign in to comment.