Skip to content

Commit af2ce5c

Browse files
committed
Update readme.md
1 parent 5e3656e commit af2ce5c

6 files changed

Lines changed: 37 additions & 48 deletions

File tree

WebApi/backend/integrations/ansible.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@ def run_ansible(self):
6262
self.clear_data()
6363
return output
6464
except subprocess.CalledProcessError as e:
65+
self.clear_data()
6566
return e.output
6667

6768
def clear_data(self):
68-
new_data = ""
69-
with open(self.ansibleHost, 'w') as arquivo:
70-
arquivo.writelines(new_data)
71-
with open(self.ansiblePlaybook, 'w') as arquivo:
72-
arquivo.writelines(new_data)
69+
playbook_file = open(self.ansiblePlaybook, 'w')
70+
playbook_file.close()
71+
host_file = open(self.ansibleHost, 'w')
72+
host_file.close()
73+
return True
Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +0,0 @@
1-
---
2-
datacenter:
3-
children:
4-
routers:
5-
hosts:
6-
10.0.0.10
7-
vars:
8-
ansible_connection: network_cli
9-
ansible_network_os: ios
10-
ansible_user: teste
11-
ansible_ssh_pass: teste
12-
ansible_become_password: teste
Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +0,0 @@
1-
---
2-
- name: Cisco Device Automation - Custom Commands
3-
hosts: all
4-
gather_facts: yes
5-
6-
vars:
7-
cli:
8-
host: "{{ ansible_host }}"
9-
username: "{{ ansible_user }}"
10-
password: "{{ ansible_ssh_pass }}"
11-
transport: cli
12-
13-
tasks:
14-
- name: Custom Commands
15-
ce_command:
16-
commands: |
17-
none
18-
register: display_output
19-
20-
- name: Command Output
21-
debug:
22-
var: display_output.stdout_lines

WebApi/frontend/templates/home.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ <h3 id="#how-work">How Work</h3>
1313
<p>provide the relevant user and password information, </p>
1414
<p>specify the equipment (Host) you want to access, and define the commands to be executed (Playbook).</p>
1515
<h1>How we build this</h1>
16-
<p>The ApiWeb was developed using the Django Framework and ansible libraries,
16+
<p>The SwitchSetup was developed using the Django Framework and ansible libraries,
1717
<p>leveraging the power of Python and software engineering principles.</p>
1818
<hr>
1919
<h1>Be free to collaborate!</h1>

WebApi/frontend/templates/updateUser.html

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33

44

55
<h3>{{page}}</h3>
6+
67
<form method="post">
78
{% csrf_token %}
8-
99
{% if settings == 0 %}
1010
<div class="form-group">
1111
<label>Username</label>
@@ -45,10 +45,6 @@ <h3>{{page}}</h3>
4545
<button type="submit" class="btn btn-danger px-5 mb-5 w-100">Confirm</button>
4646
</div>
4747
{% endif %}
48-
49-
50-
51-
5248
</form>
5349

5450

readme.md

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
- [Setup](#setup)
1616
- [Secret Key](#secretkey)
1717
- [Configure your .env](#configure-env)
18+
- [DataBase](#database)
1819
- [Version](#version)
1920
- [Videos](#videos)
2021

@@ -23,9 +24,11 @@
2324

2425
You can use Docker Image
2526

27+
The current version of the project is 1.2, which is considered the most stable and reliable release available. This version has undergone extensive testing and debugging to ensure a high level of stability and performance.
28+
2629
```
27-
sudo docker pull xandouglas/switchsetup:v1.1
28-
sudo docker run -p 8000:8000 --name switchsetup -d xandouglas/switchsetup:v1.1
30+
sudo docker pull xandouglas/switchsetup:v1.2
31+
sudo docker run -p 8000:8000 --name switchsetup -d xandouglas/switchsetup:v1.2
2932
```
3033

3134
After creating the image, use for login:
@@ -45,12 +48,14 @@ To set up the project locally, please follow these steps:
4548
5. You can run it in your terminal or dockerfile
4649

4750
### Terminal: **(Before starting run [Configure your .env](#configure-env))**
51+
4852
```
4953
cd WebApi
5054
python manage.py runserver
5155
```
5256

5357
### Dockerfile: **(Before starting run [Configure your .env](#configure-env))**
58+
5459
```
5560
docker build -t image_name
5661
docker run -p 8000:8000 image_name
@@ -59,7 +64,7 @@ docker run -p 8000:8000 image_name
5964

6065
## SecretKey
6166

62-
Start the Python interpreter
67+
Start the **Python interpreter**
6368
```
6469
import secrets
6570
secrets.token_hex(32)
@@ -77,6 +82,27 @@ DEBUG=True
7782
```
7883
**Use DEBUG=TRUE only when in development.**
7984

85+
## Database
86+
87+
We use SQLite at first, but it is possible to manage other databases.
88+
89+
Use [Django's](https://docs.djangoproject.com/en/4.2/ref/databases/) own reference.
90+
91+
If you lose the database file or decide to switch to a different one, you will need to follow these steps:
92+
93+
1. Generate a new migration ( **Inside the WebApi file** )
94+
95+
96+
```
97+
python manage.py makemigrations
98+
python manage.py migrate
99+
```
100+
101+
2. Create a new user ( **Inside the WebApi file** )
102+
103+
```
104+
python manage.py createsuperuser
105+
```
80106

81107
## Version
82108

0 commit comments

Comments
 (0)