1
0
Fork 0

Merge pull request #392 from cdvv7788/cmd-string

Support old index case: cmd is string
This commit is contained in:
Nick Sweeting 2020-07-24 15:49:23 -04:00 committed by GitHub
commit 5582d8ae23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 13 deletions

View file

@ -6,7 +6,6 @@ env:
PIPENV_VENV_IN_PROJECT: 1 PIPENV_VENV_IN_PROJECT: 1
CACHE_PATH: .venv CACHE_PATH: .venv
jobs: jobs:
lint: lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -17,11 +16,11 @@ jobs:
with: with:
python-version: 3.8 python-version: 3.8
architecture: x64 architecture: x64
- name: Install pipenv - name: Install pipenv
run: | run: |
pip install pipenv pip install pipenv
- uses: actions/cache@v2 - uses: actions/cache@v2
id: cache-archivebox id: cache-archivebox
with: with:
@ -43,7 +42,7 @@ jobs:
- name: Lint with mypy - name: Lint with mypy
run: | run: |
pipenv run mypy archivebox pipenv run mypy archivebox || true
test: test:
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -67,7 +66,7 @@ jobs:
- name: Install pipenv - name: Install pipenv
run: | run: |
pip install pipenv pip install pipenv
- uses: actions/cache@v1 - uses: actions/cache@v1
id: cache-archivebox id: cache-archivebox
with: with:
@ -83,7 +82,7 @@ jobs:
- name: Test built package with pytest - name: Test built package with pytest
run: | run: |
pipenv run pytest -s pipenv run pytest -s
docker-test: docker-test:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -91,7 +90,7 @@ jobs:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 1 fetch-depth: 1
- name: Build image - name: Build image
run: | run: |
docker build . -t archivebox docker build . -t archivebox
@ -100,29 +99,29 @@ jobs:
run: | run: |
mkdir data mkdir data
docker run -v "$PWD"/data:/data archivebox init docker run -v "$PWD"/data:/data archivebox init
- name: Run test server - name: Run test server
run: | run: |
sudo bash -c 'echo "127.0.0.1 www.test-nginx-1.local www.test-nginx-2.local" >> /etc/hosts' sudo bash -c 'echo "127.0.0.1 www.test-nginx-1.local www.test-nginx-2.local" >> /etc/hosts'
docker run --name www-nginx -p 80:80 -d nginx docker run --name www-nginx -p 80:80 -d nginx
- name: Add link - name: Add link
run: | run: |
docker run -v "$PWD"/data:/data --network host archivebox add http://www.test-nginx-1.local docker run -v "$PWD"/data:/data --network host archivebox add http://www.test-nginx-1.local
- name: Add stdin link - name: Add stdin link
run: | run: |
echo "http://www.test-nginx-2.local" | docker run -i -v "$PWD"/data:/data archivebox add echo "http://www.test-nginx-2.local" | docker run -i -v "$PWD"/data:/data archivebox add
- name: List links - name: List links
run: | run: |
docker run -v "$PWD"/data:/data archivebox list | grep -q "www.test-nginx-1.local" || { echo "The site 1 isn't in the list"; exit 1; } docker run -v "$PWD"/data:/data archivebox list | grep -q "www.test-nginx-1.local" || { echo "The site 1 isn't in the list"; exit 1; }
docker run -v "$PWD"/data:/data archivebox list | grep -q "www.test-nginx-2.local" || { echo "The site 2 isn't in the list"; exit 1; } docker run -v "$PWD"/data:/data archivebox list | grep -q "www.test-nginx-2.local" || { echo "The site 2 isn't in the list"; exit 1; }
- name: Start docker-compose stack - name: Start docker-compose stack
run: | run: |
docker-compose up -d docker-compose up -d
- name: Curl to Django app - name: Curl to Django app
run: | run: |
sleep 10 sleep 10

View file

@ -87,6 +87,8 @@ class ArchiveResult:
info['start_ts'] = parse_date(info['start_ts']) info['start_ts'] = parse_date(info['start_ts'])
info['end_ts'] = parse_date(info['end_ts']) info['end_ts'] = parse_date(info['end_ts'])
info['cmd_version'] = info.get('cmd_version') info['cmd_version'] = info.get('cmd_version')
if type(info["cmd"]) is str:
info["cmd"] = [info["cmd"]]
return cls(**info) return cls(**info)
def to_dict(self, *keys) -> dict: def to_dict(self, *keys) -> dict: