Skip to content

Commit be3239f

Browse files
committed
merge upstream
2 parents 36b1576 + 6aa85fa commit be3239f

File tree

9 files changed

+20
-26
lines changed

9 files changed

+20
-26
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ jobs:
3535

3636
steps:
3737
- name: Checkout repository
38-
uses: actions/checkout@v2
38+
uses: actions/checkout@v3
3939

4040
# Initializes the CodeQL tools for scanning.
4141
- name: Initialize CodeQL
42-
uses: github/codeql-action/init@v1
42+
uses: github/codeql-action/init@v2
4343
with:
4444
languages: ${{ matrix.language }}
4545
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -50,7 +50,7 @@ jobs:
5050
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5151
# If this step fails, then you should remove it and run the build manually (see below)
5252
- name: Autobuild
53-
uses: github/codeql-action/autobuild@v1
53+
uses: github/codeql-action/autobuild@v2
5454

5555
# ℹ️ Command-line programs to run using the OS shell.
5656
# 📚 https://git.io/JvXDl
@@ -64,4 +64,4 @@ jobs:
6464
# make release
6565

6666
- name: Perform CodeQL Analysis
67-
uses: github/codeql-action/analyze@v1
67+
uses: github/codeql-action/analyze@v2

.github/workflows/deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141

4242
- name: Extract metadata (tags, labels) for Docker
4343
id: meta
44-
uses: docker/metadata-action@v3
44+
uses: docker/metadata-action@v4
4545
with:
4646
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4747
flavor: |
@@ -50,7 +50,7 @@ jobs:
5050
type=semver,pattern={{version}}
5151
5252
- name: Build and push Docker image
53-
uses: docker/build-push-action@v2
53+
uses: docker/build-push-action@v3
5454
with:
5555
context: .
5656
file: ./Dockerfile

.github/workflows/python-lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@ jobs:
1414
build:
1515
runs-on: ubuntu-latest
1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
- name: Set up Python 3.8
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v4
2020
with:
2121
python-version: 3.8
2222
- name: Install dependencies
2323
run: |
2424
sudo apt-get update
2525
sudo apt-get install libdbus-glib-1-dev libgirepository1.0-dev
2626
python -m pip install --upgrade pip
27-
pip install flake8 pytest
27+
pip install flake8 pytest wheel
2828
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
2929
- name: Lint with flake8
3030
run: |

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@ RUN apk add --no-cache \
88
build-base \
99
dbus-dev \
1010
dbus-libs \
11+
git \
1112
glib-dev
1213

1314
# Copy Python requirements file
1415
COPY src/requirements.txt /tmp/
1516

1617
# Install packages into a directory
18+
RUN pip install wheel --no-cache-dir
1719
RUN pip install --user -r /tmp/requirements.txt --no-cache-dir
1820

1921

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ services:
2828
context: .
2929
dockerfile: Dockerfile
3030
network_mode: "host"
31-
restart: always
31+
restart: on-failure
3232
volumes:
3333
- "py_wifi_connect_db:/app/db" # Optional if not setting the hotspot ssid and password via the API
3434
labels:

src/common/errors.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ class WifiNetworkManagerError(Exception):
4646
pass
4747

4848

49-
class WifiNoSuitableDevice(Exception):
50-
pass
51-
52-
5349
# Custom error messages for Flask-RESTful to return
5450
errors = {
5551
"WifiConnectionFailed": {
@@ -72,8 +68,4 @@ class WifiNoSuitableDevice(Exception):
7268
"message": "Failed communicating with Network Manager.",
7369
"status": 500,
7470
},
75-
"WifiNoSuitableDevice": {
76-
"message": "No suitable Wi-Fi device available.",
77-
"status": 404,
78-
},
7971
}

src/common/wifi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import os
44
import socket
55
import subprocess
6+
import sys
67
import time
78
from common.errors import logger
89
from common.errors import WifiConnectionFailed
910
from common.errors import WifiDeviceNotFound
1011
from common.errors import WifiHotspotStartFailed
1112
from common.errors import WifiNetworkManagerError
12-
from common.errors import WifiNoSuitableDevice
1313
from common.nm_dicts import get_nm_dict
1414
from common.system import led
1515
from time import sleep
@@ -251,8 +251,8 @@ def get_device():
251251
if Pnm.NM_DEVICE_TYPE_WIFI in devices:
252252
return devices[Pnm.NM_DEVICE_TYPE_WIFI]
253253
else:
254-
logger.error("No suitable or available device found.")
255-
raise WifiNoSuitableDevice
254+
logger.error("No suitable or available WiFi device found. Exiting.")
255+
sys.exit(0)
256256

257257

258258
def list_access_points():

src/requirements.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
python-dotenv
1+
git+https://github.com/balena-io-experimental/python-networkmanager
22
Flask-Cors
33
Flask-RESTful
4-
python-networkmanager==2.1
4+
python-dotenv
55
waitress

src/requirements.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#
2-
# This file is autogenerated by pip-compile with python 3.9
3-
# To update, run:
2+
# This file is autogenerated by pip-compile with Python 3.10
3+
# by the following command:
44
#
55
# pip-compile
66
#
@@ -26,7 +26,7 @@ markupsafe==2.1.0
2626
# via jinja2
2727
python-dotenv==0.19.2
2828
# via -r requirements.in
29-
python-networkmanager==2.1
29+
python-networkmanager @ git+https://github.com/balena-io-experimental/python-networkmanager
3030
# via -r requirements.in
3131
pytz==2021.3
3232
# via flask-restful

0 commit comments

Comments
 (0)