Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Zuul job python-black #670

Merged
merged 1 commit into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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