diff --git a/infrastructure/cdn-in-a-box/traffic_ops/adduser.pl b/infrastructure/cdn-in-a-box/traffic_ops/adduser.pl index 31503c8ff8..31dba2d9d2 100755 --- a/infrastructure/cdn-in-a-box/traffic_ops/adduser.pl +++ b/infrastructure/cdn-in-a-box/traffic_ops/adduser.pl @@ -24,23 +24,27 @@ use Crypt::ScryptKDF qw{ scrypt_hash }; if ($#ARGV < 2) { - die "Usage: $ARGV[0] \n"; + die "Usage: $ARGV[0] USERNAME PASSWORD [ROLE] [TENANT] [EMAIL] [FULL_NAME]\n"; } -my $username = shift // 'admin'; +my $username = shift // $ENV{TO_ADMIN_USER}; my $password = shift or die "Password is required\n"; my $role = shift // 'admin'; my $tenant = shift // 'root'; +my $email = shift // $ENV{TO_EMAIL}; +my $full_name = shift // $ENV{TO_ADMIN_FULL_NAME}; # Skip the insert if the admin 'username' is already there. my $hashed_passwd = hash_pass( $password ); print <<"EOSQL"; -INSERT INTO tm_user (username, role, local_passwd, confirm_local_passwd, tenant_id) +INSERT INTO tm_user (username, role, local_passwd, confirm_local_passwd, tenant_id, email, full_name) VALUES ('$username', (SELECT id FROM role WHERE name = '$role'), '$hashed_passwd', '$hashed_passwd', - (SELECT id FROM tenant WHERE name='$tenant')) + (SELECT id FROM tenant WHERE name='$tenant'), + '$email', + '$full_name') ON CONFLICT (username) DO UPDATE SET local_passwd='$hashed_passwd', confirm_local_passwd='$hashed_passwd'; EOSQL diff --git a/infrastructure/cdn-in-a-box/traffic_portal_integration_test/run.sh b/infrastructure/cdn-in-a-box/traffic_portal_integration_test/run.sh index 1186c29195..d42a9ac9ec 100755 --- a/infrastructure/cdn-in-a-box/traffic_portal_integration_test/run.sh +++ b/infrastructure/cdn-in-a-box/traffic_portal_integration_test/run.sh @@ -44,7 +44,7 @@ done cat conf.js -protractor conf.js --params.adminUser 'admin' --params.adminPassword 'twelve' +protractor conf.js --params.adminUser "$TO_ADMIN_USER" --params.adminPassword "$TO_ADMIN_PASSWORD" rc=$? cp /portaltestresults/* /junit/ diff --git a/infrastructure/cdn-in-a-box/variables.env b/infrastructure/cdn-in-a-box/variables.env index 8a9bdfa60f..b99cbdd872 100644 --- a/infrastructure/cdn-in-a-box/variables.env +++ b/infrastructure/cdn-in-a-box/variables.env @@ -68,8 +68,9 @@ TM_LOG_ERROR=stdout TM_LOG_WARNING=stdout TM_LOG_INFO=stdout TM_LOG_DEBUG=stdout -TO_ADMIN_PASSWORD=twelve +TO_ADMIN_PASSWORD=twelve12 TO_ADMIN_USER=admin +TO_ADMIN_FULL_NAME=James Cole # Set TM_DEBUG_ENABLE to true`to debug Traffic Monitor with Delve TM_DEBUG_ENABLE=false # Set TO_DEBUG_ENABLE to true`to debug Traffic Ops with Delve