diff options
Diffstat (limited to 'auth')
-rw-r--r-- | auth/auth-batch/pom.xml | 3 | ||||
-rw-r--r-- | auth/auth-batch/src/assemble/auth-batch.xml | 23 | ||||
-rw-r--r-- | auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java | 25 | ||||
-rw-r--r-- | auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java | 5 | ||||
-rw-r--r-- | auth/auth-cass/cass_init/authBatch.props | 23 | ||||
-rw-r--r-- | auth/auth-cass/cass_init/cmd.sh | 3 | ||||
-rw-r--r-- | auth/auth-cass/cass_init/restore.sh | 2 | ||||
-rw-r--r-- | auth/auth-cass/docker/Dockerfile.cass | 1 |
8 files changed, 33 insertions, 52 deletions
diff --git a/auth/auth-batch/pom.xml b/auth/auth-batch/pom.xml index 78dfe2ce..cb44ea38 100644 --- a/auth/auth-batch/pom.xml +++ b/auth/auth-batch/pom.xml @@ -55,9 +55,6 @@ </developers> <properties> - - - <maven.test.failure.ignore>false</maven.test.failure.ignore> <!-- SONAR --> <!-- <sonar.skip>true</sonar.skip> --> diff --git a/auth/auth-batch/src/assemble/auth-batch.xml b/auth/auth-batch/src/assemble/auth-batch.xml index eb0456ee..aadf4e0e 100644 --- a/auth/auth-batch/src/assemble/auth-batch.xml +++ b/auth/auth-batch/src/assemble/auth-batch.xml @@ -32,29 +32,6 @@ <dependencySet> <unpack>true</unpack> <scope>compile</scope> - <!-- includes> - <include>org.onap.aaf.authz:aaf-auth-batch</include> - <include>org.onap.aaf.authz:aaf-auth-core</include> - <include>org.onap.aaf.authz:aaf-cadi-core</include> - <include>org.onap.aaf.authz:aaf-misc-env</include> - <include>org.onap.aaf.authz:aaf-misc-rosetta</include> - <include>javax.xml.bind:jaxb-api</include> - <include>org.glassfish.jaxb:jaxb-runtime</include> - </includes --> - <includes> - <include>org.onap.aaf.authz:aaf-auth-batch</include> - <include>org.onap.aaf.authz:aaf-auth-core</include> - <include>org.onap.aaf.authz:aaf-cadi-core</include> - <include>org.onap.aaf.authz:aaf-auth-cass</include> - <include>org.onap.aaf.authz:aaf-misc-env</include> - <include>org.onap.aaf.authz:aaf-misc-rosetta</include> - <include>com.datastax.cassandra:cassandra-driver-core</include> - <include>javax.xml.bind:jaxb-api</include> - <include>org.glassfish.jaxb:jaxb-runtime</include> - <include>com.sun.istack:istack-commons-runtime</include> - <include>javax.activation:javax.activation-api</include> - <include>log4j:log4j</include> - </includes> </dependencySet> </dependencySets> </assembly> diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java index d2695a35..3058ddc5 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/Batch.java @@ -55,7 +55,6 @@ import org.onap.aaf.cadi.PropAccess; import org.onap.aaf.cadi.config.Config; import org.onap.aaf.misc.env.APIException; import org.onap.aaf.misc.env.Env; -import org.onap.aaf.misc.env.StaticSlot; import org.onap.aaf.misc.env.TimeTaken; import org.onap.aaf.misc.env.util.Chrono; import org.onap.aaf.misc.env.util.Split; @@ -68,9 +67,6 @@ import com.datastax.driver.core.Session; import com.datastax.driver.core.Statement; public abstract class Batch { - - private static StaticSlot ssargs; - protected static final String STARS = "*****"; protected static Cluster cluster; @@ -83,6 +79,8 @@ public abstract class Batch { private static File logdir; + private static String[] batchArgs; + public static final String CASS_ENV = "CASS_ENV"; public static final String LOG_DIR = "LOG_DIR"; protected static final String MAX_EMAILS="MAX_EMAILS"; @@ -157,7 +155,7 @@ public abstract class Batch { protected void _close(AuthzTrans trans) {} public String[] args() { - return env.get(ssargs); + return batchArgs; } public boolean isDryRun() @@ -380,11 +378,12 @@ public abstract class Batch { // Use a StringBuilder to save off logs until a File can be setup StringBuilderOutputStream sbos = new StringBuilderOutputStream(); PropAccess access = new PropAccess(new PrintStream(sbos),args); - access.log(Level.INIT, "------- Starting Batch ------\n Args: "); + access.log(Level.INFO, "------- Starting Batch ------\n Args: "); for(String s: args) { sbos.getBuffer().append(s); sbos.getBuffer().append(' '); } + sbos.getBuffer().append('\n'); InputStream is = null; String filename; @@ -454,13 +453,10 @@ public abstract class Batch { len -= 1; if (len < 0) len = 0; - String nargs[] = new String[len]; + batchArgs = new String[len]; if (len > 0) { - System.arraycopy(args, 1, nargs, 0, len); + System.arraycopy(args, 1, batchArgs, 0, len); } - - env.put(ssargs = env.staticSlot("ARGS"), nargs); - /* * Add New Batch Programs (inherit from Batch) here */ @@ -505,6 +501,7 @@ public abstract class Batch { if (cls != null) { Constructor<?> cnst = cls.getConstructor(AuthzTrans.class); batch = (Batch) cnst.newInstance(trans); + System.out.println(batch.getClass().getCanonicalName()); env.info().log("Begin", classifier, toolName); } @@ -519,8 +516,12 @@ public abstract class Batch { } if (batch != null) { try { + for(String s : batchArgs) { + System.out.println(s); + } batch.run(trans); } catch (Exception e) { + trans.error().log(e); if(cluster!=null && !cluster.isClosed()) { cluster.close(); } @@ -536,6 +537,8 @@ public abstract class Batch { trans.auditTrail(4, sb, AuthzTrans.SUB, AuthzTrans.REMOTE); trans.info().log(sb); } + } catch (Exception e) { + env.warn().log(e); } finally { batchLog.close(); } diff --git a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java index b0db0a79..83de05af 100644 --- a/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java +++ b/auth/auth-batch/src/main/java/org/onap/aaf/auth/batch/update/Upload.java @@ -85,6 +85,10 @@ public class Upload extends Batch { @Override protected void run(AuthzTrans trans) { List<File> files = new ArrayList<>(); + for(String s : args()) { + trans.init().log(s); + } + if(args().length>0) { File dir = new File(args()[0]); if(dir.isDirectory()) { @@ -105,6 +109,7 @@ public class Upload extends Batch { } } } + for(File file : files) { String f = file.getName(); final Feed feed = feeds.get(f.substring(0,f.length()-4)); diff --git a/auth/auth-cass/cass_init/authBatch.props b/auth/auth-cass/cass_init/authBatch.props index 0505ce8b..bef1659b 100644 --- a/auth/auth-cass/cass_init/authBatch.props +++ b/auth/auth-cass/cass_init/authBatch.props @@ -1,24 +1,21 @@ -aaf_data_dir=/opt/app/aaf/data +aaf_data_dir=/opt/app/aaf/cass_init/data aaf_root_ns=org.osaaf.aaf cadi_latitude=38.0 cadi_longitude=-72.0 +cadi_loglevel=INFO ## Supported Plugin Organizational Units Organization.att.com=org.onap.aaf.org.DefaultOrg DRY_RUN=false -CASS_ENV=DOCKER - -UNKNOWN.LOG_DIR=logs/DOCKER ## Cassandra Configurations, when commented out, uses LocalHost (non authenticated) and default ports -DOCKER.cassandra.clusters=127.0.0.1 -DOCKER.cassandra.clusters.port=9042 -DOCKER.cassandra.clusters.user=cassandra -DOCKER.cassandra.clusters.password=cassandra -DOCKER.VERSION=3.1.0 -DOCKER.GUI_URL=https://mithrilcsp.sbc.com:8095/gui -DOCKER.MAX_EMAILS=3 -DOCKER.SPECIAL_NAMES=aaf@aaf.osaaf.org +cassandra.clusters=127.0.0.1 +cassandra.clusters.port=9042 +cassandra.clusters.user=cassandra +cassandra.clusters.password=cassandra + +GUI_URL=https://aaf-gui.onap:8095/gui +MAX_EMAILS=3 +SPECIAL_NAMES=aaf@aaf.osaaf.org -cadi_loglevel=AUDIT diff --git a/auth/auth-cass/cass_init/cmd.sh b/auth/auth-cass/cass_init/cmd.sh index dc3e7f80..d9120872 100644 --- a/auth/auth-cass/cass_init/cmd.sh +++ b/auth/auth-cass/cass_init/cmd.sh @@ -135,7 +135,8 @@ function install_onap { status prep data bash prep.sh status push data to cassandra - bash push.sh + # bash push.sh + echo "YES" | bash restore.sh cd - echo $(date) > $AAF_INIT_DATA fi diff --git a/auth/auth-cass/cass_init/restore.sh b/auth/auth-cass/cass_init/restore.sh index 528978af..abc6a7cc 100644 --- a/auth/auth-cass/cass_init/restore.sh +++ b/auth/auth-cass/cass_init/restore.sh @@ -52,7 +52,7 @@ done if [ ! "$UPLOAD" = "" ]; then cd dats - java -Dcadi_prop_files=../authBatch.props -DCASS_ENV=$ENV -jar ../aaf-auth-batch-*-full.jar Upload $UPLOAD + java -Dcadi_prop_files=../authBatch.props -DCASS_ENV=$ENV -jar ../aaf-auth-batch-*-full.jar Upload $UPLOAD 2>&1 logs/stdout cd - fi diff --git a/auth/auth-cass/docker/Dockerfile.cass b/auth/auth-cass/docker/Dockerfile.cass index 0db5fa57..0f12d8c8 100644 --- a/auth/auth-cass/docker/Dockerfile.cass +++ b/auth/auth-cass/docker/Dockerfile.cass @@ -30,6 +30,7 @@ COPY cass_init/*.sh /opt/app/aaf/cass_init/ COPY cass_init/*.props /opt/app/aaf/cass_init/ COPY aaf-auth-batch-*-full.jar /opt/app/aaf/cass_init/ COPY cass_data/*.dat /opt/app/aaf/cass_init/dats/ +COPY sample.identities.dat /opt/app/aaf/cass_init/data/identites.dat RUN mkdir -p /opt/app/aaf/status && chmod 777 /opt/app/aaf/status && \ addgroup ${USER} && adduser --no-create-home --ingroup ${USER} --disabled-password --gecos "" --shell /bin/bash ${USER} && \ |