GithubHelp home page GithubHelp logo

rht-labs / automation-api Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 10.0 214 KB

Spring Cloud Kubernetes RESTful API for all the automation offered at Red Hat Open Innovation Labs

License: Apache License 2.0

Java 99.95% Shell 0.05%

automation-api's People

Contributors

goern avatar infosec812 avatar mcanoy avatar mdanter avatar sherl0cks avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

automation-api's Issues

Deletes Fail in DB's Migrated From Original Flyway Impl

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement
	at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:112) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:42) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:95) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:207) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:45) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3209) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:3446) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.action.internal.EntityDeleteAction.execute(EntityDeleteAction.java:98) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:582) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:456) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:337) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:39) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1282) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:465) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.internal.SessionImpl.flushBeforeTransactionCompletion(SessionImpl.java:2963) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.internal.SessionImpl.beforeTransactionCompletion(SessionImpl.java:2339) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.beforeTransactionCompletion(JdbcCoordinatorImpl.java:485) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.beforeCompletionCallback(JdbcResourceLocalTransactionCoordinatorImpl.java:147) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl.access$100(JdbcResourceLocalTransactionCoordinatorImpl.java:38) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.resource.transaction.backend.jdbc.internal.JdbcResourceLocalTransactionCoordinatorImpl$TransactionDriverControlImpl.commit(JdbcResourceLocalTransactionCoordinatorImpl.java:231) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.engine.transaction.internal.TransactionImpl.commit(TransactionImpl.java:65) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	at org.hibernate.jpa.internal.TransactionImpl.commit(TransactionImpl.java:61) ~[hibernate-entitymanager-5.0.11.Final.jar!/:5.0.11.Final]
	at org.springframework.orm.jpa.JpaTransactionManager.doCommit(JpaTransactionManager.java:517) ~[spring-orm-4.3.5.RELEASE.jar!/:4.3.5.RELEASE]
	... 78 common frames omitted
Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "role" violates foreign key constraint "fk5160c0kl5j1c2t89ogoxoqwt0" on table "role_mapping_roles"
  Detail: Key (id)=(11) is still referenced from table "role_mapping_roles".
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2182) ~[postgresql-9.4-1206-jdbc42.jar!/:9.4]
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1911) ~[postgresql-9.4-1206-jdbc42.jar!/:9.4]
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:173) ~[postgresql-9.4-1206-jdbc42.jar!/:9.4]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:645) ~[postgresql-9.4-1206-jdbc42.jar!/:9.4]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:495) ~[postgresql-9.4-1206-jdbc42.jar!/:9.4]
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:441) ~[postgresql-9.4-1206-jdbc42.jar!/:9.4]
	at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:204) ~[hibernate-core-5.0.11.Final.jar!/:5.0.11.Final]
	... 97 common frames omitted

Application fails to start

The application fails to start with the following errors:

java.sql.SQLException: Unable to load class: org.postgresql.Driver from ClassLoader:org.springframework.boot.loader.LaunchedURLClassLoader@7b23ec81;ClassLoader:org.springframework.boot.loader.LaunchedURLClassLoader@7b23ec81

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

I encountered these errors when running the application as part of the CI-CD Bootstrap.

CC @sherl0cks

Engagement start and end date not properly persisted

Start and end dates are being created as byte arrays in the datastore during the schema auto-generation. The cause is due to the code-generation done by swagger to create dates using LocalDate which is not supported by JPA OOTB.

See db schema here

Database Validation

Place constraints in the JPA (orm.xml). Current versions are very liberal with column size / unique / check constraints...

Support RouteType default

{
  "timestamp": 1477596978182,
  "status": 400,
  "error": "Bad Request",
  "exception": "org.springframework.http.converter.HttpMessageNotReadableException",
  "message": "Could not read document: Can not deserialize value of type com.rhc.automation.model.Route$RouteTypeEnum from String \"default\": value not one of declared Enum instance names: [reencrypt, passthrough, edge]\n at [Source: java.io.PushbackInputStream@6955e89; line: 647, column: 25] (through reference chain: com.rhc.automation.model.Engagement[\"openshift_clusters\"]->java.util.ArrayList[0]->com.rhc.automation.model.OpenShiftCluster[\"openshift_resources\"]->com.rhc.automation.model.OpenShiftResources[\"projects\"]->java.util.ArrayList[6]->com.rhc.automation.model.Project[\"apps\"]->java.util.ArrayList[1]->com.rhc.automation.model.Application[\"routes\"]->java.util.ArrayList[0]->com.rhc.automation.model.Route[\"route_type\"]); nested exception is com.fasterxml.jackson.databind.exc.InvalidFormatException: Can not deserialize value of type com.rhc.automation.model.Route$RouteTypeEnum from String \"default\": value not one of declared Enum instance names: [reencrypt, passthrough, edge]\n at [Source: java.io.PushbackInputStream@6955e89; line: 647, column: 25] (through reference chain: com.rhc.automation.model.Engagement[\"openshift_clusters\"]->java.util.ArrayList[0]->com.rhc.automation.model.OpenShiftCluster[\"openshift_resources\"]->com.rhc.automation.model.OpenShiftResources[\"projects\"]->java.util.ArrayList[6]->com.rhc.automation.model.Project[\"apps\"]->java.util.ArrayList[1]->com.rhc.automation.model.Application[\"routes\"]->java.util.ArrayList[0]->com.rhc.automation.model.Route[\"route_type\"])",
  "path": "/engagements"
}

PUT on engagement does not work as expected

Use should be able to perform the following steps, which currently results in an NPE.

  1. GET /engagement/123
  2. modify the returned object by code or by hand
  3. PUT /engagement/123
  4. GET /engagement/123 returns the object from step 2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.