Skip to content

Commit

Permalink
[resotoeventlog][feat] Genesis of resotoeventlog (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
aquamatthias committed May 30, 2022
1 parent c31cfe5 commit 99c09e7
Show file tree
Hide file tree
Showing 75 changed files with 12,580 additions and 314 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/check_pr_resotoeventlog.yml
@@ -0,0 +1,61 @@
name: Check PR (resotoeventlog)
on:
push:
tags:
- "*.*.*"
branches:
- main
pull_request:
paths:
- 'resotoeventlog/**'
- 'resotolib/**'
- '.github/**'

jobs:
resotoeventlog:
name: "resotoeventlog"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
architecture: 'x64'

- name: Restore dependency cache
uses: actions/cache@v2
with:
path: ~/.cache/pip
key: $\{\{runner.os}}-pip-$\{\{hashFiles('./resotoeventlog/setup.py')}}
restore-keys: |
$\{\{ runner.os }}-pip-
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install tox wheel flake8 build
pip install --upgrade --editable resotolib/
- name: Run tests
working-directory: ./resotoeventlog
run: tox -p 4 -o

- name: Build a binary wheel and a source tarball
working-directory: ./resotoeventlog
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution to PyPI
if: github.ref_type == 'tag'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_resotoeventlog }}
packages_dir: ./resotoeventlog/dist/
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -30,3 +30,4 @@ docs/_build/
resotoshell/backup_*
resotocore/tools/Assets
out/
*.iml
Expand Up @@ -10,7 +10,7 @@
from resotolib.graph import Graph


class DigitalOceanCollectorPlugin(BaseCollectorPlugin): # type: ignore
class DigitalOceanCollectorPlugin(BaseCollectorPlugin):
cloud = "digitalocean"

def collect(self) -> None:
Expand Down
13 changes: 7 additions & 6 deletions plugins/digitalocean/resoto_plugin_digitalocean/client.py
@@ -1,14 +1,15 @@
from typing import Dict, List, Any, Optional, Union, TypeVar, Callable
import logging
from dataclasses import dataclass
from functools import lru_cache
import requests
from typing import Dict, List, Any, Optional, Union, TypeVar, Callable

import boto3
import requests
from botocore.exceptions import EndpointConnectionError, HTTPClientError
from retrying import retry as retry_decorator
from resoto_plugin_digitalocean.utils import retry_on_error
from resoto_plugin_digitalocean.utils import RetryableHttpError
import resotolib.logger
from resoto_plugin_digitalocean.utils import retry_on_error
from resotolib.config import Config
from retrying import retry as retry_decorator

F = TypeVar("F", bound=Callable[..., Any])

Expand All @@ -22,7 +23,7 @@ def retry(func: F) -> F:
)(func)


log = resotolib.logger.getLogger("resoto." + __name__)
log = logging.getLogger("resoto." + __name__)

Json = Dict[str, Any]

Expand Down
12 changes: 6 additions & 6 deletions plugins/digitalocean/resoto_plugin_digitalocean/collector.py
@@ -1,10 +1,10 @@
import logging
import math
from pprint import pformat
from typing import Tuple, Type, List, Dict, Callable, Any, Optional, cast

from prometheus_client import Summary

import resotolib.logger
from resotolib.baseresources import BaseResource, EdgeType
from resotolib.graph import Graph
from .client import StreamingWrapper
Expand Down Expand Up @@ -67,7 +67,7 @@

Json = Dict[str, Any]

log = resotolib.logger.getLogger("resoto." + __name__)
log = logging.getLogger("resoto." + __name__)

metrics_collect_projects = Summary(
"resoto_plugin_digitalocean_collect_projects_seconds",
Expand Down Expand Up @@ -402,15 +402,15 @@ def add_deferred_connection(
if isinstance(value, List):
values = value
for value in values:
resource_instance.add_deferred_connection(
resource_instance.add_deferred_connection( # type: ignore
attr,
value,
is_parent,
is_parent, # type: ignore
edge_type=edge_type,
)
elif isinstance(value, str):
resource_instance.add_deferred_connection(
attr, value, is_parent, edge_type=edge_type
resource_instance.add_deferred_connection( # type: ignore
attr, value, is_parent, edge_type=edge_type # type: ignore
)
else:
log.error(
Expand Down

0 comments on commit 99c09e7

Please sign in to comment.