Skip to content

Commit

Permalink
Merge pull request #43 from Onemind-Services-LLC/dev
Browse files Browse the repository at this point in the history
Release v0.2.0
  • Loading branch information
kprince28 authored May 20, 2024
2 parents a31eb2a + 17ed25b commit 8fe5fd8
Show file tree
Hide file tree
Showing 38 changed files with 168 additions and 128 deletions.
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
## Reporting Bugs

* First, ensure that you're running the [latest stable version](https://github.com/netbox-community/netbox/releases)
of NetBox or this plugin [latest stable version](https://github.com/Onemind-Services-LLC/netbox-cloud-pilot/releases).
of NetBox or this plugin [latest stable version](https://github.com/Onemind-Services-LLC/netbox-paas/releases).
If you're running an older version, it's possible that the bug has already been fixed
or you are running a version of the plugin not tested with the NetBox version
you are running [Compatibility Matrix](./README.md#compatibility).

* Next, check the GitHub [issues list](https://github.com/Onemind-Services-LLC/netbox-cloud-pilot/issues)
* Next, check the GitHub [issues list](https://github.com/Onemind-Services-LLC/netbox-paas/issues)
to see if the bug you've found has already been reported. If you think you may
be experiencing a reported issue that hasn't already been resolved, please
click "add a reaction" in the top right corner of the issue and add a thumbs
Expand All @@ -27,7 +27,7 @@ provide all information request in the issue template, including:

## Feature Requests

* First, check the GitHub [issues list](https://github.com/Onemind-Services-LLC/netbox-cloud-pilot/issues)
* First, check the GitHub [issues list](https://github.com/Onemind-Services-LLC/netbox-paas/issues)
to see if the feature you're requesting is already listed. (Be sure to search
closed issues as well, since some feature requests have been rejected.) If the
feature you'd like to see has already been requested and is open, click "add a
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ARG NETBOX_VARIANT=v3.6

FROM netboxcommunity/netbox:${NETBOX_VARIANT}

RUN mkdir -pv /plugins/netbox-cloud-pilot
COPY . /plugins/netbox-cloud-pilot
RUN mkdir -pv /plugins/netbox-paas
COPY . /plugins/netbox-paas

RUN python3 /plugins/netbox-cloud-pilot/setup.py develop
RUN cp -rf /plugins/netbox-cloud-pilot/netbox_cloud_pilot/ /opt/netbox/venv/lib/python3.11/site-packages/netbox_cloud_pilot
RUN python3 /plugins/netbox-paas/setup.py develop
RUN cp -rf /plugins/netbox-paas/netbox_paas/ /opt/netbox/venv/lib/python3.11/site-packages/netbox_paas
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
include README.md
recursive-include netbox_cloud_pilot/templates *
recursive-include netbox_paas/templates *
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# NetBox Cloud Pilot
# NetBox PaaS

[NetBox Cloud Pilot](https://github.com/Onemind-Services-LLC/netbox-cloud-pilot) is a specialized plugin tailored for
[NetBox PaaS](https://github.com/Onemind-Services-LLC/netbox-paas) is a specialized plugin tailored for
NetBox, offering enhanced functionality for users on the
[CloudMyDC public Cloud platform (VAP)](https://app.xapp.cloudmydc.com/). This plugin simplifies the management of
various NetBox components and infrastructure, streamlining processes and offering a more integrated experience.

NetBox Cloud Pilot, developed and maintained by [Onemind Services LLC](https://onemindservices.com/), introduces an
NetBox PaaS, developed and maintained by [Onemind Services LLC](https://onemindservices.com/), introduces an
exclusive plugin store for NetBox. It caters to users with a diverse range of both free and paid plugins, enhancing the
NetBox experience.

## Features

NetBox Cloud Pilot integrates several key features:
NetBox PaaS integrates several key features:

- **Management of NetBox Settings**: Control settings for Database (DB), Redis, System, and security and much more.
- **Infrastructure Log Viewing**: Access and monitor logs from different nodes within the infrastructure.
Expand All @@ -28,13 +28,13 @@ NetBox Cloud Pilot integrates several key features:

# Installation

For updates, visit [NetBox Cloud Pilot releases](https://github.com/Onemind-Services-LLC/netbox-cloud-pilot/releases).
For updates, visit [NetBox PaaS releases](https://github.com/Onemind-Services-LLC/netbox-paas/releases).

## Support

For support, questions, or feedback, please file an issue on our [GitHub issue tracker](https://github.com/Onemind-Services-LLC/netbox-cloud-pilot/issues).
For support, questions, or feedback, please file an issue on our [GitHub issue tracker](https://github.com/Onemind-Services-LLC/netbox-paas/issues).

## Contributing

Contributions to NetBox Cloud Pilot are welcome! If you'd like to contribute, please fork the repository and submit a
Contributions to NetBox PaaS are welcome! If you'd like to contribute, please fork the repository and submit a
pull request. For more detailed information, refer to our contributing guidelines in the repository.
4 changes: 2 additions & 2 deletions configuration/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# See https://github.com/netbox-community/netbox-docker/wiki/Using-Netbox-Plugins

PLUGINS = [
"netbox_cloud_pilot",
"netbox_paas",
]

PLUGINS_CONFIG = { # type: ignore
"netbox_cloud_pilot": {},
"netbox_paas": {},
}
4 changes: 1 addition & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
version: '3.4'

services:
netbox:
build:
Expand All @@ -10,7 +8,7 @@ services:
- redis
env_file: env/netbox.env
environment:
ENV_NAME: netbox-cloud-pilot
ENV_NAME: netbox-paas
volumes:
- ./configuration:/etc/netbox/config:z,ro

Expand Down
29 changes: 0 additions & 29 deletions netbox_cloud_pilot/navigation.py

This file was deleted.

8 changes: 4 additions & 4 deletions netbox_cloud_pilot/__init__.py → netbox_paas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@

from extras.plugins import PluginConfig

metadata = metadata("netbox_cloud_pilot")
metadata = metadata("netbox_paas")


class NetBoxCloudPilot(PluginConfig):
class NetBoxPaas(PluginConfig):
name = metadata.get("Name").replace("-", "_")
verbose_name = metadata.get("Name")
description = metadata.get("Summary")
version = metadata.get("Version")
author = metadata.get("Author")
author_email = metadata.get("Author-email")
base_url = "cloud-pilot"
base_url = "paas"
min_version = "3.6.0"
max_version = "3.6.99"

Expand All @@ -25,4 +25,4 @@ def ready(self):
raise Exception("ENV_NAME is not set in the environment")


config = NetBoxCloudPilot
config = NetBoxPaas
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@


class NetBoxConfigurationSerializer(NetBoxModelSerializer):
url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_cloud_pilot-api:netboxconfiguration-detail"
)
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_paas-api:netboxconfiguration-detail")

env_name = serializers.CharField(
read_only=True,
Expand Down Expand Up @@ -54,17 +52,15 @@ class Meta:


class NestedNetBoxConfigurationSerializer(WritableNestedSerializer):
url = serializers.HyperlinkedIdentityField(
view_name="plugins-api:netbox_cloud_pilot-api:netboxconfiguration-detail"
)
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_paas-api:netboxconfiguration-detail")

class Meta:
model = NetBoxConfiguration
fields = ("id", "url", "display", "env_name", "env_name_storage", "is_enterprise")


class NetBoxDBBackupSerializer(NetBoxModelSerializer):
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_cloud_pilot-api:netboxdbbackup-detail")
url = serializers.HyperlinkedIdentityField(view_name="plugins-api:netbox_paas-api:netboxdbbackup-detail")

netbox_env = NestedNetBoxConfigurationSerializer()

Expand Down
2 changes: 1 addition & 1 deletion netbox_cloud_pilot/api/urls.py → netbox_paas/api/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from . import views

app_name = "netbox_cloud_pilot"
app_name = "netbox_paas"

router = NetBoxRouter()
router.register("configurations", views.NetBoxConfigurationViewSet)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion netbox_cloud_pilot/iaas.py → netbox_paas/iaas.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from . import utils
from .constants import JELASTIC_API, NODE_GROUP_CP, NODE_GROUP_SQLDB, DISABLED_PLUGINS_FILE_NAME, PLUGINS_FILE_NAME

logger = logging.getLogger("netbox_cloud_pilot")
logger = logging.getLogger("netbox_paas")

__all__ = (
"IaaS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Migration(migrations.Migration):
('last_updated', models.DateTimeField(auto_now=True, null=True)),
('crontab', models.CharField(default='@daily', max_length=255)),
('keep_backups', models.PositiveIntegerField(default=1)),
('netbox_env', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='db_backups', to='netbox_cloud_pilot.netboxconfiguration')),
('netbox_env', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='db_backups', to='netbox_paas.netboxconfiguration')),
],
options={
'verbose_name': 'NetBox DB Backup',
Expand Down
52 changes: 52 additions & 0 deletions netbox_paas/migrations/0002_rename_application.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Generated by Django 4.2.8 on 2024-05-10 05:43

from django.db import migrations, models
import django.db.models.deletion


def migrate_models(apps, schema_editor):
try:
OldModel1 = apps.get_model('netbox_cloud_pilot', 'NetBoxConfiguration')
OldModel2 = apps.get_model('netbox_cloud_pilot', 'NetBoxDBBackup')
except LookupError:
# Skip if the old models don't exist
return

NewModel1 = apps.get_model('netbox_paas', 'NetBoxConfiguration')
NewModel2 = apps.get_model('netbox_paas', 'NetBoxDBBackup')

# Migrate data from old models to new models
for old_instance in OldModel1.objects.all():
new_instance = NewModel1(
id=old_instance.id,
key=old_instance.key,
env_name_storage=old_instance.env_name_storage,
license=old_instance.license,
description=old_instance.description,
created=old_instance.created,
last_updated=old_instance.last_updated,
custom_field_data=old_instance.custom_field_data,
comments=old_instance.comments,
)
new_instance.save()

for old_instance in OldModel2.objects.all():
new_instance = NewModel2(
id=old_instance.id,
created=old_instance.created,
last_updated=old_instance.last_updated,
crontab=old_instance.crontab,
keep_backups=old_instance.keep_backups,
netbox_env_id=old_instance.netbox_env.id,
)
new_instance.save()


class Migration(migrations.Migration):
dependencies = [
('netbox_paas', '0001_initial'),
]

operations = [
migrations.RunPython(migrate_models),
]
File renamed without changes.
12 changes: 3 additions & 9 deletions netbox_cloud_pilot/models.py → netbox_paas/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import json
from netbox.models import ChangeLoggedModel, PrimaryModel
from netbox.models.features import JobsMixin
from taggit.managers import TaggableManager
from .constants import (
NETBOX_SUPERUSER_SETTINGS,
NETBOX_SETTINGS,
Expand Down Expand Up @@ -53,11 +52,6 @@ class NetBoxConfiguration(JobsMixin, PrimaryModel):
null=True,
)

tags = TaggableManager(
through='extras.TaggedItem',
related_name='netbox_cloud_pilot_netboxconfigurations',
)

class Meta:
verbose_name = "NetBox Configuration"
verbose_name_plural = "NetBox Configurations"
Expand All @@ -70,7 +64,7 @@ def env_name(self):
return os.environ.get("ENV_NAME")

def get_absolute_url(self):
return reverse("plugins:netbox_cloud_pilot:netboxconfiguration", args=[self.pk])
return reverse("plugins:netbox_paas:netboxconfiguration", args=[self.pk])

def clean(self):
if self.__class__.objects.exists() and not self.pk:
Expand Down Expand Up @@ -242,7 +236,7 @@ def schedule_restart(self):

class NetBoxDBBackup(ChangeLoggedModel):
netbox_env = models.ForeignKey(
to="netbox_cloud_pilot.NetBoxConfiguration",
to=NetBoxConfiguration,
on_delete=models.CASCADE,
related_name="db_backups",
verbose_name="NetBox Environment",
Expand All @@ -267,7 +261,7 @@ class Meta:
verbose_name_plural = "NetBox DB Backups"

def get_absolute_url(self):
return reverse("plugins:netbox_cloud_pilot:netboxdbbackup", args=[self.pk])
return reverse("plugins:netbox_paas:netboxdbbackup", args=[self.pk])

def __str__(self):
return self.crontab
Expand Down
29 changes: 29 additions & 0 deletions netbox_paas/navigation.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from extras.plugins import PluginMenu
from extras.plugins import PluginMenuItem

menu = PluginMenu(
label="Netbox PAAS",
icon_class="mdi mdi-cloud",
groups=(
(
"",
(
PluginMenuItem(
link_text="Manage",
link="plugins:netbox_paas:netboxconfiguration_list",
permissions=["netbox_paas.view_netboxconfiguration"],
),
PluginMenuItem(
link_text="DB Backups",
link="plugins:netbox_paas:netboxdbbackup_list",
permissions=["netbox_paas.change_netboxconfiguration"],
),
PluginMenuItem(
link_text="Plugins Store",
link="plugins:netbox_paas:netboxplugin_list",
permissions=["netbox_paas.view_netboxconfiguration"],
),
),
),
),
)
File renamed without changes.
2 changes: 1 addition & 1 deletion netbox_cloud_pilot/tables.py → netbox_paas/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
__all__ = ("NetBoxBackupsTable",)

RESTORE_BUTTON = """
<form method="post" action="{% url 'plugins:netbox_cloud_pilot:netboxdbbackup_restore' pk=object.pk %}">
<form method="post" action="{% url 'plugins:netbox_paas:netboxdbbackup_restore' pk=object.pk %}">
{% csrf_token %}
<input type="hidden" name="name" value="{{ record.name }}">
<button type="submit" class="btn btn-sm btn-warning">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ <h2 class="accordion-header" id="{{ card_header }}nodegroup{{ forloop.counter }}
<button
type="submit"
class="btn btn-sm btn-danger"
formaction="{% url 'plugins:netbox_cloud_pilot:netboxconfiguration_restart' pk=object.pk %}"
formaction="{% url 'plugins:netbox_paas:netboxconfiguration_restart' pk=object.pk %}"
>
<i class="mdi mdi-restart"></i> Restart
</button>

<button
type="submit"
class="btn btn-sm btn-primary"
formaction="{% url 'plugins:netbox_cloud_pilot:netboxconfiguration_logs' pk=object.pk %}"
formaction="{% url 'plugins:netbox_paas:netboxconfiguration_logs' pk=object.pk %}"

>
<i class="mdi mdi-file-document-outline"></i> Logs
Expand Down
Loading

0 comments on commit 8fe5fd8

Please sign in to comment.