Project

General

Profile

Bug #57724 ยป multisite_admin_api_user_creation_repro_script.sh

Ali Maredia, 09/29/2022 12:56 PM

 
#!/bin/bash

# cluster 1
MON=1 OSD=1 RGW=1 MGR=0 MDS=0 ../src/mstart.sh c1 -n -d
./bin/radosgw-admin -c ./run/c1/ceph.conf realm create --rgw-realm=realm1
./bin/radosgw-admin -c ./run/c1/ceph.conf zonegroup create --rgw-realm=realm1 --rgw-zonegroup=zg1 --master --endpoints=http://127.0.0.1:8001
./bin/radosgw-admin -c ./run/c1/ceph.conf zone create --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1 --endpoints=http://127.0.0.1:8001 --master
./bin/radosgw-admin -c ./run/c1/ceph.conf period update --commit --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1
./bin/radosgw-admin -c ./run/c1/ceph.conf user create --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1 --uid=test4 --display-name=test4 --access-key=test4 --secret=test4 --system
./bin/radosgw-admin -c ./run/c1/ceph.conf user create --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1 --uid=test3 --display-name=test3 --access-key=test3 --secret=test3
./bin/radosgw-admin -c ./run/c1/ceph.conf caps add --uid=test3 --caps="users=*buckets=*;"
./bin/radosgw-admin -c ./run/c1/ceph.conf zone modify --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1 --access-key=test4 --secret-key=test4
./bin/radosgw-admin -c ./run/c1/ceph.conf period update --commit --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone1
kill $(cat run/c1/out/radosgw.8001.pid)
sleep 3
./bin/radosgw -c ./run/c1/ceph.conf --log-file=./run/c1/out/radosgw.8001.log --admin-socket=./run/c1/out/radosgw.8001.asok --pid-file=./run/c1/out/radosgw.8001.pid --rgw_luarocks_location=./run/c1/out/luarocks --debug-rgw=20 --debug-ms=1 -n client.rgw.8001 --rgw_frontends='beast port=8001' --rgw_realm=realm1 --rgw_zonegroup=zg1 --rgw_zone=zone1
sleep 3
curl -L http://localhost:8001

# cluster 2
MON=1 OSD=1 RGW=1 MGR=0 MDS=0 ../src/mstart.sh c2 -n -d
./bin/radosgw-admin -c ./run/c2/ceph.conf realm pull --url=http://localhost:8001 --access-key=test4 --secret=test4
./bin/radosgw-admin -c ./run/c2/ceph.conf zone create --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone2 --endpoints=http://127.0.0.1:8002 --access-key=test4 --secret-key=test4
./bin/radosgw-admin -c ./run/c2/ceph.conf period update --commit --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone2
kill $(cat run/c2/out/radosgw.8002.pid)
sleep 3
./bin/radosgw -c ./run/c2/ceph.conf --log-file=./run/c2/out/radosgw.8002.log --admin-socket=./run/c2/out/radosgw.8002.asok --pid-file=./run/c2/out/radosgw.8002.pid --rgw_luarocks_location=./run/c2/out/luarocks --debug-rgw=20 --debug-ms=1 -n client.rgw.8002 --rgw_frontends='beast port=8002' --rgw_realm=realm1 --rgw_zonegroup=zg1 --rgw_zone=zone2
#./bin/radosgw-admin -c ./run/c2/ceph.conf period update --commit --rgw-realm=realm1 --rgw-zonegroup=zg1 --rgw-zone=zone2
sleep 5
curl -L http://localhost:8002

### ADMIN API USER CREATION REQUESTS ON PRIMARY CLUSTER
# NO KEYS: SUCEEDS EXPECTED BEHAVIOR
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8001 -r PUT -p user -q "uid=foouser&display-name=foo"
# PROVIDE KEYS: SUCEEDS EXPECTED BEHAVIOR
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8001 -r PUT -p user -q "uid=foouser&display-name=foo&access-key=akey&secret-key=skey"
# GENERATE-KEYS: SUCEEDS EXPECTED BEHAVIOR
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8001 -r PUT -p user -q "uid=foouser&display-name=foo&generate-key=True"


### ADMIN API USER CREATION REQUESTS ON SECONDARY CLUSTER
# NO KEYS: returns keys that do not look the same as what's in radosgw-admin user info
sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8002 -r PUT -p user -q "uid=foouser&display-name=foo"
# PROVIDE KEYS: returns keys that do look the same as what's in radosgw-admin user info but are NOT what the user had input
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8002 -r PUT -p user -q "uid=foouser&display-name=foo&access-key=akey&secret-key=skey"
# GENERATE-KEYS: returns keys that do not look the same as what's in radosgw-admin user info
#sh ../examples/rgw_admin_curl.sh -a test3 -s test3 -e localhost:8002 -r PUT -p user -q "uid=foouser&display-name=foo&generate-key=True"


# In all tests there is no difference between keys see on radosgw-admin user info run on primary cluster vs secondary
#./bin/radosgw-admin -c ./run/c1/ceph.conf user info --uid=foouser
./bin/radosgw-admin -c ./run/c2/ceph.conf user info --uid=foouser

../src/mstop.sh c1
../src/mstop.sh c2
    (1-1/1)