TOSCA: Add missing artifacts references
The TOSCA wordpress template is missing artifacts. These artifacts were tested with actual deployment but never added here. Unit tests are there for this template for TOSCA parser side and we are working on to create tests for the full translated template with HOT mapping. Change-Id: I9ddedc6ee6e072e765d3d3fe6b97a2a7d8aa91d8
This commit is contained in:
parent
01f85e17b8
commit
d064f39c45
9
translator/toscalib/tests/artifacts/mysql/mysql_database_configure.sh
Executable file
9
translator/toscalib/tests/artifacts/mysql/mysql_database_configure.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/bin/sh -x
|
||||
# Setup MySQL root password and create user
|
||||
cat << EOF | mysql -u root --password=db_root_password
|
||||
CREATE DATABASE db_name;
|
||||
GRANT ALL PRIVILEGES ON db_name.* TO "db_user"@"localhost"
|
||||
IDENTIFIED BY "db_password";
|
||||
FLUSH PRIVILEGES;
|
||||
EXIT
|
||||
EOF
|
3
translator/toscalib/tests/artifacts/mysql/mysql_dbms_configure.sh
Executable file
3
translator/toscalib/tests/artifacts/mysql/mysql_dbms_configure.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh -x
|
||||
# Set the MySQL server root password
|
||||
mysqladmin -u root password db_root_password
|
4
translator/toscalib/tests/artifacts/mysql/mysql_dbms_install.sh
Executable file
4
translator/toscalib/tests/artifacts/mysql/mysql_dbms_install.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/sh -x
|
||||
yum -y install mysql mysql-server
|
||||
# Use systemd to start MySQL server at system boot time
|
||||
#systemctl enable mysqld.service
|
3
translator/toscalib/tests/artifacts/mysql/mysql_dbms_start.sh
Executable file
3
translator/toscalib/tests/artifacts/mysql/mysql_dbms_start.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh -x
|
||||
# Start the MySQL service (NOTE: may already be started at image boot time)
|
||||
systemctl start mysqld.service
|
3
translator/toscalib/tests/artifacts/webserver/webserver_install.sh
Executable file
3
translator/toscalib/tests/artifacts/webserver/webserver_install.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh -x
|
||||
yum -y install httpd
|
||||
systemctl enable httpd.service
|
3
translator/toscalib/tests/artifacts/webserver/webserver_start.sh
Executable file
3
translator/toscalib/tests/artifacts/webserver/webserver_start.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh -x
|
||||
# Start the httpd service (NOTE: may already be started at image boot time)
|
||||
systemctl start httpd.service
|
7
translator/toscalib/tests/artifacts/wordpress/wordpress_configure.sh
Executable file
7
translator/toscalib/tests/artifacts/wordpress/wordpress_configure.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh -x
|
||||
sed -i "/Deny from All/d" /etc/httpd/conf.d/wordpress.conf
|
||||
sed -i "s/Require local/Require all granted/" /etc/httpd/conf.d/wordpress.conf
|
||||
sed -i s/database_name_here/db_name/ /etc/wordpress/wp-config.php
|
||||
sed -i s/username_here/db_user/ /etc/wordpress/wp-config.php
|
||||
sed -i s/password_here/db_password/ /etc/wordpress/wp-config.php
|
||||
systemctl restart httpd.service
|
2
translator/toscalib/tests/artifacts/wordpress/wordpress_install.sh
Executable file
2
translator/toscalib/tests/artifacts/wordpress/wordpress_install.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh -x
|
||||
yum -y install wordpress
|
@ -36,14 +36,14 @@ node_templates:
|
||||
- database_endpoint: mysql_database
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
create: wordpress_install.sh
|
||||
configure:
|
||||
implementation: wordpress_configure.sh
|
||||
inputs:
|
||||
wp_db_name: { get_property: [ mysql_database, db_name ] }
|
||||
wp_db_user: { get_property: [ mysql_database, db_user ] }
|
||||
wp_db_password: { get_property: [ mysql_database, db_password ] }
|
||||
wp_db_port: { get_property: [ SELF, database_endpoint, port ] }
|
||||
create: wordpress/wordpress_install.sh
|
||||
configure:
|
||||
implementation: wordpress/wordpress_configure.sh
|
||||
inputs:
|
||||
wp_db_name: { get_property: [ mysql_database, db_name ] }
|
||||
wp_db_user: { get_property: [ mysql_database, db_user ] }
|
||||
wp_db_password: { get_property: [ mysql_database, db_password ] }
|
||||
wp_db_port: { get_property: [ SELF, database_endpoint, port ] }
|
||||
|
||||
mysql_database:
|
||||
type: tosca.nodes.Database
|
||||
@ -59,11 +59,14 @@ node_templates:
|
||||
- host: mysql_dbms
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
configure:
|
||||
implementation: mysql_database_configure.sh
|
||||
inputs:
|
||||
db_port: { get_property: [ SELF, database_endpoint, port ] }
|
||||
|
||||
configure:
|
||||
implementation: mysql/mysql_database_configure.sh
|
||||
inputs:
|
||||
db_name: { get_property: [ SELF, db_name ] }
|
||||
db_user: { get_property: [ SELF, db_user ] }
|
||||
db_password: { get_property: [ SELF, db_password ] }
|
||||
db_root_password: { get_property: [ mysql_dbms, dbms_root_password ] }
|
||||
db_port: { get_property: [ SELF, database_endpoint, port ] }
|
||||
mysql_dbms:
|
||||
type: tosca.nodes.DBMS
|
||||
properties:
|
||||
@ -73,10 +76,10 @@ node_templates:
|
||||
- host: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
create: mysql_dbms_install.sh
|
||||
start: mysql_dbms_start.sh
|
||||
create: mysql/mysql_dbms_install.sh
|
||||
start: mysql/mysql_dbms_start.sh
|
||||
configure:
|
||||
implementation: mysql_dbms_configure.sh
|
||||
implementation: mysql/mysql_dbms_configure.sh
|
||||
inputs:
|
||||
db_user: { get_input: db_user }
|
||||
db_root_password: { get_property: [ mysql_dbms, dbms_root_password ] }
|
||||
@ -87,8 +90,8 @@ node_templates:
|
||||
- host: server
|
||||
interfaces:
|
||||
tosca.interfaces.node.lifecycle.Standard:
|
||||
create: webserver_install.sh
|
||||
start: webserver_start.sh
|
||||
create: webserver/webserver_install.sh
|
||||
start: webserver/webserver_start.sh
|
||||
|
||||
server:
|
||||
type: tosca.nodes.Compute
|
||||
|
@ -141,13 +141,13 @@ class ToscaTemplateTest(TestCase):
|
||||
if interface.name == 'create':
|
||||
self.assertEqual(ifaces.LIFECYCLE,
|
||||
interface.type)
|
||||
self.assertEqual('wordpress_install.sh',
|
||||
self.assertEqual('wordpress/wordpress_install.sh',
|
||||
interface.implementation)
|
||||
self.assertIsNone(interface.inputs)
|
||||
elif interface.name == 'configure':
|
||||
self.assertEqual(ifaces.LIFECYCLE,
|
||||
interface.type)
|
||||
self.assertEqual('wordpress_configure.sh',
|
||||
self.assertEqual('wordpress/wordpress_configure.sh',
|
||||
interface.implementation)
|
||||
self.assertEqual(4, len(interface.inputs))
|
||||
wp_db_port = interface.inputs['wp_db_port']
|
||||
|
Loading…
x
Reference in New Issue
Block a user