Skip to content

Commit

Permalink
Add Zuul job python-black and format Python files
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Neumann <neumann@b1-systems.de>
  • Loading branch information
sbstnnmnn committed Nov 13, 2023
1 parent e15d1cb commit 90b93c0
Show file tree
Hide file tree
Showing 13 changed files with 7 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .zuul.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,19 @@
- hadolint
- container-image-python-osism-build
- mypy
- python-black
gate:
jobs:
- flake8
- hadolint
- python-black
periodic-daily:
jobs:
- flake8
- hadolint
- container-image-python-osism-push
- mypy
- python-black
post:
jobs:
- container-image-python-osism-push:
Expand Down
1 change: 0 additions & 1 deletion files/import/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ def createDeviceTypes(deviceTypes, nb):


def main():

cwd = os.getcwd()
startTime = datetime.now()

Expand Down
1 change: 0 additions & 1 deletion osism/actions/check_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@


def for_device(name, parameters={}):

device = utils.nb.dcim.devices.get(name=name)

if (
Expand Down
3 changes: 0 additions & 3 deletions osism/actions/deploy_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@


def for_device(name, parameters={}, mode="deploy"):

device = utils.nb.dcim.devices.get(name=name)

if (
Expand Down Expand Up @@ -53,7 +52,6 @@ def for_device(name, parameters={}, mode="deploy"):
if not first and last_commit == current_commit and mode == "deploy":
logger.info(f"No deployment for device {device.name} required")
else:

if not first:
try:
last_configuration = repo.git.show(
Expand All @@ -76,7 +74,6 @@ def for_device(name, parameters={}, mode="deploy"):
f"There is now prepared configuration for device {device.name}"
)
else:

t = jinja2.Environment(loader=jinja2.BaseLoader()).from_string(
current_configuration
)
Expand Down
1 change: 0 additions & 1 deletion osism/actions/diff_configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@


def for_device(name, parameters={}):

device = utils.nb.dcim.devices.get(name=name)

if (
Expand Down
2 changes: 0 additions & 2 deletions osism/actions/manage_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ def manage_interfaces(device, data):
lag_interfaces = get_lag_interfaces(data)

for interface in data[device]:

if data[device][interface]["type"] in ["virtual", "port-channel", "mlag"]:
continue

Expand Down Expand Up @@ -311,7 +310,6 @@ def manage_interfaces(device, data):

# ensure that all interfaces are enabled that should be enabled
if not interface_a.enabled:

if "enabled" in data[device][interface]["data"]:
interface_a.enabled = bool(data[device][interface]["data"]["enabled"])
else:
Expand Down
4 changes: 1 addition & 3 deletions osism/commands/reconciler.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,4 @@ def take_action(self, parsed_args):
redis.close()
return rc
else:
logger.info(
f"Task {t.task_id} is running in background. No more output."
)
logger.info(f"Task {t.task_id} is running in background. No more output.")
1 change: 0 additions & 1 deletion osism/commands/vault.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@


class SetPassword(Command):

keyfile = "/share/ansible_vault_password.key"

def get_parser(self, prog_name):
Expand Down
3 changes: 0 additions & 3 deletions osism/commands/wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ def take_action(self, parsed_args):
result = AsyncResult(f"{task_id}", app=app)

if result.state == "PENDING":

q = i.query_task(f"{task_id}")
if not len([x for x in q.values() if len(x)]):
if format == "log":
Expand All @@ -79,7 +78,6 @@ def take_action(self, parsed_args):
task_ids.insert(0, task_id)

elif result.state == "SUCCESS":

if format == "log":
logger.info(f"Task {task_id} is in state SUCCESS")
elif format == "script":
Expand All @@ -89,7 +87,6 @@ def take_action(self, parsed_args):
print(result.get())

elif result.state == "STARTED":

if format == "log":
logger.info(f"Task {task_id} is in state STARTED")
elif format == "script":
Expand Down
2 changes: 0 additions & 2 deletions osism/services/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ def on_message(self, body, message):
netbox.set_state.delay(name, object_data["provision_state"], "provision")

if object_data["provision_state"] == "manageable":

# system should be in state c
netbox.connect.delay(name, "c")

Expand All @@ -120,7 +119,6 @@ def on_message(self, body, message):
object_data["previous_provision_state"] == "cleaning"
and object_data["provision_state"] == "available"
): # noqa

# system should be in state c
netbox.connect.delay(name, "c")

Expand Down
4 changes: 3 additions & 1 deletion osism/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ def read_secret(secret_name):

# 43200 seconds = 12 hours
GATHER_FACTS_SCHEDULE = float(os.getenv("GATHER_FACTS_SCHEDULE", "43200.0"))
INVENTORY_RECONCILER_SCHEDULE = float(os.getenv("INVENTORY_RECONCILER_SCHEDULE", "600.0"))
INVENTORY_RECONCILER_SCHEDULE = float(
os.getenv("INVENTORY_RECONCILER_SCHEDULE", "600.0")
)
1 change: 0 additions & 1 deletion osism/tasks/conductor.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ def celery_init_worker(**kwargs):

# Resolve all IDs in the conductor.yml
if Config.enable_ironic in ["True", "true", "Yes", "yes"]:

if "ironic_parameters" not in configuration:
logger.error(
"ironic_parameters not found in the conductor configuration"
Expand Down
1 change: 0 additions & 1 deletion osism/tasks/netbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ def celery_init_worker(**kwargs):

@app.on_after_configure.connect
def setup_periodic_tasks(sender, **kwargs):

if Config.enable_bifrost in ["True", "true", "Yes", "yes"]:
# Synchronize the status of Bifrost with Netbox every 5 minutes
sender.add_periodic_task(300.0, periodic_synchronize_bifrost.s(), expires=10)
Expand Down

0 comments on commit 90b93c0

Please sign in to comment.