Skip to content

Commit 3a1305f

Browse files
authored
Merge pull request #204 from ansibleguy76/release/v5.0.4
v5.0.4 into main
2 parents 337f1ca + 5efedef commit 3a1305f

28 files changed

+330
-84
lines changed

CHANGELOG.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,21 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [5.0.4] - 2024-08-18
11+
12+
### Added
13+
14+
- If forms.yaml is missing, it will be auto created. This is useful for new installations without docker-compose
15+
- Same for certificates
16+
17+
### Changed
18+
19+
- Async await replacements for promises (readability)
20+
21+
### Fixed
22+
23+
- Some credentials bugfixes
24+
1025
## [5.0.3] - 2024-06-21
1126

1227
### Added
@@ -709,7 +724,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
709724
- Allow change password for current local user
710725
- Start tracking versions
711726

712-
[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.3...HEAD
727+
[Unreleased]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.4...HEAD
728+
729+
[5.0.4]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.3...5.0.4
713730

714731
[5.0.3]: https://github.com/ansibleguy76/ansibleforms/compare/5.0.2...5.0.3
715732

app_versions.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
ext.version_code = 50003
2-
ext.version_name = "5.0.3"
1+
ext.version_code = 50004
2+
ext.version_name = "5.0.4"

client/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ansible_forms_vue",
3-
"version": "5.0.3",
3+
"version": "5.0.4",
44
"private": true,
55
"scripts": {
66
"serve": "vue-cli-service serve",
@@ -19,7 +19,7 @@
1919
"@fortawesome/free-regular-svg-icons": "~6.5.2",
2020
"@fortawesome/free-solid-svg-icons": "~6.5.2",
2121
"@fortawesome/vue-fontawesome": "2.0.10",
22-
"axios": "~1.7.2",
22+
"axios": "~1.7.4",
2323
"brace": "~0.11.1",
2424
"bulma": "0.9.4",
2525
"bulma-calendar": "6.1.19",
@@ -28,7 +28,7 @@
2828
"bulma-quickview": "*",
2929
"bulmaswatch": "0.8.1",
3030
"copy-to-clipboard": "~3.3.3",
31-
"core-js": "~3.37.1",
31+
"core-js": "~3.38.0",
3232
"es6-promise": "~4.2.8",
3333
"highlight.js": "9.11.0",
3434
"jsonwebtoken": "^9.0.2",

client/src/components/Form.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1740,7 +1740,7 @@
17401740
var ref=this
17411741
axios({
17421742
method: 'get',
1743-
headers,
1743+
headers: headers.headers,
17441744
url,
17451745
responseType: 'arraybuffer',
17461746
})

client/src/views/Credentials.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,16 @@
151151
}else{
152152
console.log("No item selected")
153153
this.credential = {
154-
name:""
154+
is_database:false,
155+
name:"",
156+
user:"",
157+
password:"",
158+
host:"NA",
159+
port:3306,
160+
db_name:"",
161+
description:"",
162+
secure:false,
163+
db_type:""
155164
}
156165
}
157166
},

client/src/views/Jobs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@
383383
var ref=this
384384
axios({
385385
method: 'get',
386-
headers,
386+
headers: headers.headers,
387387
url,
388388
responseType: 'arraybuffer',
389389
})

client/src/views/Logs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
var ref=this
105105
axios({
106106
method: 'get',
107-
headers,
107+
headers:headers.headers,
108108
url,
109109
responseType: 'arraybuffer',
110110
})

docs/_data/help.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3837,7 +3837,7 @@
38373837
'get',
38383838
'https://resturl/api/',
38393839
'',
3840-
{'a_custom_http_header','your_value'},
3840+
{'a_custom_http_header':'your_value'},
38413841
'.records[].name',
38423842
{name:{ignoreCase:true,direction:'desc'}},
38433843
false
@@ -4217,7 +4217,7 @@
42174217
description: ""
42184218
awxCredentials:
42194219
- vmware
4220-
execution_environment: my_execution_environment
4220+
executionEnvironment: my_execution_environment
42214221
roles:
42224222
- public
42234223
categories: []
@@ -4261,7 +4261,7 @@
42614261
columns:
42624262
- name
42634263
valueColumn: name
4264-
- name: __execution_environment__ # use this special name to override the execution_environment from the form
4264+
- name: __executionEnvironment__ # use this special name to override the executionEnvironment from the form
42654265
label: Inventory
42664266
type: enum
42674267
expression: "fn.fnRestJwtSecure('get','https://172.16.50.1/api/v2/execution_environments?organization=$(organization)','','awx_rest','[.results[]]')"
@@ -4307,11 +4307,11 @@
43074307
You can also choose if the repository must be cloned when AnsibleForms starts, and you can add cron-schedule to schedule recurring pull-actions.
43084308
Additionally, in the swagger interface, you will find a clone and pull rest api for webhooks.
43094309
In case you want long-lived access tokens for the webhooks, with swagger you can pass an expiryDays parameter (for admin roles only) and create long-lived tokens.
4310-
- name: Host Ansibleforms in a subfolder
4311-
short: Host Ansibleforms in a subfolder
4312-
description: |
4313-
In the case you want to host ansibleforms in subfolder, for example `https://af.domain.local/mysubfolder/`.
4314-
You can use the environment variable `BASE_URL`. Set it to `/mysubfolder/` (default is `/`).
4310+
# - name: Host Ansibleforms in a subfolder
4311+
# short: Host Ansibleforms in a subfolder
4312+
# description: |
4313+
# In the case you want to host ansibleforms in subfolder, for example `https://af.domain.local/mysubfolder/`.
4314+
# You can use the environment variable `BASE_URL`. Set it to `/mysubfolder/` (default is `/`).
43154315
- name: Enable ytt
43164316
short: Enable ytt
43174317
description: |

docs/installation.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,14 @@ AnsibleForms can be installed in a few ways.
3434
</div>
3535

3636

37-
# Install using Docker-Compose
37+
# Install using Docker-Compose
38+
39+
The recommended way to install AnsibleForms is using `Docker Compose`, which is the fastest way to start AnsibleForms with Docker. However, if you are skilled with docker, podman and/or Kubernetes, the [docker-compose (with Kubernetes sample)](https://github.com/ansibleguy76/ansibleforms-docker), together with the environment variables should get you started as well.
40+
41+
<div class="callout callout--danger">
42+
<p><strong>Note</strong> You can also use Podman and Podman-Compose. The commands are similar (docker- > podman and docker-compose -> podman-compose)</p>
43+
</div>
3844

39-
The recommended way to install AnsibleForms is using `Docker Compose`, which is the fastest way to start AnsibleForms with Docker. However, if you are skilled with docker and/or Kubernetes, the [docker-compose (with Kubernetes sample)](https://github.com/ansibleguy76/ansibleforms-docker), together with the environment variables should get you started as well.
4045

4146
<div class="callout callout--danger">
4247
<p><strong>Note</strong> Using docker and docker-compose for the first time, requires some basic linux skills and some knowledge about containers</p>
@@ -45,7 +50,7 @@ The recommended way to install AnsibleForms is using `Docker Compose`, which is
4550

4651
## Prerequisites
4752

48-
* **Linux machine** : Any flavour should do, The need of CPU and memory is not very high, but, of course can grow if you start a lot of playbooks simultaniously
53+
* **Linux machine** : Any flavour should do, The need of CPU and memory is not very high, but, of course can grow if you start a lot of playbooks simultaniously. When using Podman, I recommand Debian (ubuntu has some issues with Podman)
4954
* **Github access** : The easiest way is to download or clone the docker-compose project on Github
5055
* **Install Docker** : You need to have a container environment, and in this example we use Docker
5156
* **Install Docker Compose** : To spin-up AnsibleForms and MySql with docker, using a few simple configuration-files, we need Docker Compose
@@ -68,10 +73,8 @@ cd /srv/apps
6873
## Clone the docker-compose project
6974

7075
```bash
71-
# centos
72-
sudo yum install -y git
7376

74-
# ubuntu
77+
# ubuntu or debian
7578
sudo apt-get install -y git
7679

7780
‌sudo ‌git init
@@ -94,10 +97,7 @@ sudo chmod -R +x ./data/mysql/init/
9497
[Docker installation manuals](https://docs.docker.com/engine/install)
9598

9699
```bash
97-
# centos
98-
yum install -y docker-ce docker-ce-cli containerd.io docker-compose
99-
100-
# ubuntu
100+
# ubuntu / debian
101101
sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin docker-compose
102102

103103
# the below is to ensure dns works properly inside the dockerimages
@@ -109,6 +109,13 @@ sudo systemctl start docker
109109
sudo systemctl enable docker
110110
```
111111

112+
## Install Podman and podman-compose
113+
114+
```bash
115+
# ubuntu / debian
116+
sudo apt-get install -y podman podman-compose
117+
```
118+
112119
## Customize
113120

114121
Feel free to look at the variables in the `.env` file and `docker-compose.yaml` file.
@@ -118,6 +125,10 @@ Feel free to look at the variables in the `.env` file and `docker-compose.yaml`
118125

119126
```bash
120127
sudo docker-compose up -d
128+
# note, with some plavors and versions, it's `docker compose` (with a space)
129+
# or
130+
sudo podman-compose up -d
131+
# note that podman is service-less. You can run it as any user. Your choice to use sudo or not.
121132
```
122133

123134
## Test the application

docs/introduction.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ page_nav:
4040
* **Swagger API** : Has a rest-api and Swagger documentation
4141
* **Job History & Log** : See the history of your jobs*
4242
* **Designer** : Although the forms are NOT built using a graphical designer, a YAML based editor/designer with validation is present
43+
* **Git integration** : Sync your forms config files, ansible playbooks and other required files with a git repo
4344

4445
# Form Capabilities
4546

4647
* **Categories** : Group multiple forms under categories
4748
* **Role based access** : Limit forms based on roles
4849
* **Cascaded dropdowns** : Allow references between fields to create responsive, cascaded dropdown boxes
49-
* **Database sources** : Import data into fields from databases (MySql, MSSql, Postgres, Mongo)
50+
* **Database sources** : Import data into fields from databases (MySql, MSSql, Postgres, Mongo, Oracle)
5051
* **Expression based sources** : Import data using serverside expressions (javascript), such as Rest API's, json-files, yaml-files, ... and filter, manipulate and sort them
5152
* **Local expressions** : Use the power of javascript (local browser sandbox) to calculate, manipulate, generate, ...
5253
* **Field dependencies** : Show/hide fields based on values of other fields

server/config/https.config.js

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,43 @@
11
const fs=require('fs')
2+
const path=require('path')
23
const logger=require("../src/lib/logger");
34
var privatekey=undefined
45
var certificate=undefined
56

67
if(process.env.HTTPS=="1"){
8+
9+
var certificatePath = process.env.HTTPS_CERT || (__dirname + '/../persistent/certificates/cert.pem')
10+
var privatekeyPath = process.env.HTTPS_KEY || (__dirname + '/../persistent/certificates/key.pem')
11+
// logger.info("Using https certificate : " + certificatePath)
12+
// logger.info("Using https private key : " + privatekeyPath)
13+
14+
// check if httpsConfig.httpsKey and httpsConfig.httpsCert exist
15+
if(!fs.existsSync(certificatePath) || !fs.existsSync(privatekeyPath)){
16+
logger.warning("httpsKey or httpsCert not found, copying from templates")
17+
var certificateTemplatePath = path.join(__dirname,"/../templates/cert.pem.template")
18+
var privatekeyTemplatePath = path.join(__dirname,"/../templates/key.pem.template")
19+
var certificateDirPath = path.dirname(certificatePath)
20+
// logger.info("Using https certificate template : " + certificateTemplatePath)
21+
// logger.info("Using https private key template : " + privatekeyTemplatePath)
22+
try{
23+
// create the folder if it doesn't exist
24+
logger.info("Creating folder " + certificateDirPath)
25+
fs.mkdirSync(certificateDirPath, { recursive: true });
26+
logger.info("Copying templates to " + certificatePath + " and " + privatekeyPath)
27+
fs.copyFileSync(certificateTemplatePath, certificatePath);
28+
fs.copyFileSync(privatekeyTemplatePath, privatekeyPath);
29+
logger.info("Copied templates to " + certificatePath + " and " + privatekeyPath)
30+
}catch(e){
31+
logger.error("No certificate found and could not copy templates",e)
32+
// exit // no point to continue
33+
process.exit(1)
34+
}
35+
}
36+
37+
738
try{
8-
privatekey = fs.readFileSync(process.env.HTTPS_KEY || (__dirname + '/../persistent/certificates/key.pem'))
9-
certificate = fs.readFileSync(process.env.HTTPS_CERT || (__dirname + '/../persistent/certificates/cert.pem'))
39+
privatekey = fs.readFileSync(privatekeyPath)
40+
certificate = fs.readFileSync(certificatePath)
1041
}catch(err){
1142
logger.error("Failed to open https private key and certificate : ",err)
1243
throw new Error("Failed to open https private key and certificate : " + err.message)

server/package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ansible_forms",
3-
"version": "5.0.3",
3+
"version": "5.0.4",
44
"repository": {
55
"type": "git",
66
"url": "git://github.com/ansibleguy76/ansibleforms.git"
@@ -20,51 +20,51 @@
2020
"@outlinewiki/passport-azure-ad-oauth2": "~0.1.0",
2121
"ajv": "~6.12.6",
2222
"ajv-error-parser": "~1.0.7",
23-
"axios": "~1.7.2",
23+
"axios": "~1.7.4",
2424
"bcrypt": "~5.1.0",
2525
"bluebird": "~3.7.2",
2626
"cert-info": "~1.5.1",
27-
"cheerio": "~1.0.0-rc.12",
27+
"cheerio": "~1.0.0",
2828
"connect-history-api-fallback": "~2.0.0",
29-
"core-js": "~3.37.1",
29+
"core-js": "~3.38.0",
3030
"cors": "~2.8.5",
3131
"cron-parser": "~4.9.0",
32-
"dayjs": "1.11.11",
32+
"dayjs": "1.11.12",
3333
"express": "~4.19.2",
3434
"cookie-session": "~2.1.0",
3535
"fs-extra": "~11.2.0",
3636
"ip": "2.0.1",
3737
"json-bigint": "~1.0.0",
38-
"ldap-authentication": "~3.2.1",
38+
"ldap-authentication": "~3.2.2",
3939
"ldapjs": "~3.0.7",
4040
"lodash": "~4.17.21",
4141
"modern-passport-http": "~0.3.0",
4242
"moment": "~2.30.1",
43-
"mongodb": "~6.7.0",
44-
"oracledb": "~6.5.1",
43+
"mongodb": "~6.8.0",
44+
"oracledb": "~6.6.0",
4545
"mssql": "~10.0.2",
4646
"multer": "~1.4.5-lts.1",
47-
"mysql2": "~3.10.0",
47+
"mysql2": "~3.11.0",
4848
"node-cache": "~5.1.2",
4949
"node-jq": "~4.4.0",
50-
"nodemailer": "~6.9.8",
50+
"nodemailer": "~6.9.14",
5151
"openid-client": "^5.6.5",
5252
"passport": "~0.7.0",
5353
"passport-jwt": "~4.0.1",
5454
"pg": "~8.12.0",
5555
"read-last-lines": "~1.8.0",
5656
"swagger-ui-express": "~5.0.1",
5757
"thenby": "~1.3.4",
58-
"winston": "~3.13.0",
58+
"winston": "~3.14.1",
5959
"winston-daily-rotate-file": "~5.0.0",
6060
"winston-syslog": "~2.7.0",
6161
"yaml": "~2.4.5"
6262
},
6363
"devDependencies": {
6464
"@babel/cli": "~7.24.7",
65-
"@babel/core": "7.24.7",
66-
"@babel/eslint-parser": "7.24.7",
67-
"@babel/node": "~7.24.7",
65+
"@babel/core": "7.25.2",
66+
"@babel/eslint-parser": "7.25.1",
67+
"@babel/node": "~7.25.0",
6868
"dotenv": "~16.4.1",
6969
"eslint": "~8.56.0",
7070
"nodemon": "~3.1.3",

server/src/controllers/config.controller.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ exports.findAll = async function(req,res){
1313
var forms = await Form.load()
1414
res.json(forms)
1515
}catch(err){
16+
// console.log(err)
1617
res.json({error:helpers.getError(err)})
1718
}
1819
}

server/src/controllers/group.controller.js

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,16 @@ exports.update = function(req, res) {
5151
.catch((err)=>{res.json(new RestResult("error","failed to update group",null,err.toString()))})
5252
}
5353
};
54-
exports.delete = function(req, res) {
55-
Group.delete( req.params.id)
56-
.then((deleted)=>{
57-
if(deleted.affectedRows==1){
58-
res.json(new RestResult("success","group deleted",null,""))
59-
}else{
60-
res.json(new RestResult("error","unknown group or group has users",null,`affected rows : ${deleted.affectedRows}`))
61-
}
54+
exports.delete = async function(req, res) {
55+
try{
56+
const deleted = await Group.delete( req.params.id)
57+
if(deleted.affectedRows==1){
58+
res.json(new RestResult("success","group deleted",null,""))
59+
}else{
60+
res.json(new RestResult("error","unknown group or group has users",null,`affected rows : ${deleted.affectedRows}`))
61+
}
62+
}catch(err){
63+
res.json(new RestResult("error","failed to delete group",null,err.toString()))
64+
}
6265

63-
})
64-
.catch((err)=>{res.json(new RestResult("error","failed to delete group",null,err.toString()))})
6566
};

0 commit comments

Comments
 (0)