Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions mosip_master/data_upgrade/1.1.5.5_to_1.2.0.1/data-uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,21 @@
parser.add_argument("--dbpassword", type=str, required=False, help="DB username")
parser.add_argument("--dbhost", type=str, required=False, help="DB hostname")
parser.add_argument("--dbport", type=str, required=False, help="DB port number")
parser.add_argument("--appId", type=str, required=False, default="admin", help="App ID for client-id/secret authentication, eg: admin")
parser.add_argument("--clientId", type=str, required=True, help="Client ID for client-id/secret authentication")
parser.add_argument("--secretKey", type=str, required=True, help="Client secret key for client-id/secret authentication")

args = parser.parse_args()

## Values to be updated as per the deployment
authURL='https://'+args.domain+'/v1/authmanager/authenticate/useridPwd'
authURL='https://'+args.domain+'/v1/authmanager/authenticate/clientidsecretkey'
uploadURL='https://'+args.domain+'/v1/admin/bulkupload'
uploadStatusURL='https://'+args.domain+'/v1/admin/bulkupload/transcation/'
username=args.username
password=args.password
appId=args.appId
clientId=args.clientId
secretKey=args.secretKey

def getCurrentDateTime():
dt_now = datetime.now(timezone.utc)
Expand Down Expand Up @@ -114,15 +120,17 @@ def getAccessToken():
'id': 'string',
'metadata': {},
'request': {
'appId': 'admin',
'password': password,
'userName': username
'appId': appId,
'clientId': clientId,
'secretKey': secretKey
},
'requesttime': getCurrentDateTime(),
'version': 'string'
}
authresponse=requests.post(authURL, json= auth_req_data)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
print(json.dumps(authresponse.json()))
if authresponse.status_code != 200 or 'authorization' not in authresponse.headers:
sys.exit("Authentication failed (HTTP " + str(authresponse.status_code) + "). URL: " + authURL + " Response: " + authresponse.text)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
return authresponse.headers["authorization"]


Expand Down
18 changes: 14 additions & 4 deletions mosip_master/data_upgrade/1.1.5.5_to_1.2.0.1/migration-ui_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,25 @@
parser.add_argument("--ageGroupConfig", type=str, required=True, help="Age group configuration")
parser.add_argument("--infantAgeGroup", type=str, required=True, help="Infant Age group name")
parser.add_argument("--allowedBioAttributes", type=str, required=True, help="Comma separated list of allowed biometric attributes")
parser.add_argument("--appId", type=str, required=False, default="admin", help="App ID for client-id/secret authentication, eg: admin")
parser.add_argument("--clientId", type=str, required=True, help="Client ID for client-id/secret authentication")
parser.add_argument("--secretKey", type=str, required=True, help="Client secret key for client-id/secret authentication")

args = parser.parse_args()


## Values to be updated as per the deployment
authURL='https://'+args.domain+'/v1/authmanager/authenticate/useridPwd'
authURL='https://'+args.domain+'/v1/authmanager/authenticate/clientidsecretkey'
schemaURL='https://'+args.domain+'/v1/syncdata/latestidschema?schemaVersion=0'
uispecURL='https://'+args.domain+'/v1/masterdata/uispec'
uispecPublishURL='https://'+args.domain+'/v1/masterdata/uispec/publish'
primaryLang=args.primaryLanguage
secondaryLang=args.secondaryLanguage
username=args.username
password=args.password
appId=args.appId
clientId=args.clientId
secretKey=args.secretKey
agegroup_config=args.ageGroupConfig
infantAgeGroup = args.infantAgeGroup.strip()
allBioAttributes= args.allowedBioAttributes.strip().split(",")
Expand Down Expand Up @@ -124,15 +130,17 @@ def getAccessToken():
'id': 'string',
'metadata': {},
'request': {
'appId': 'admin',
'password': password,
'userName': username
'appId': appId,
'clientId': clientId,
'secretKey': secretKey
},
'requesttime': getCurrentDateTime(),
'version': 'string'
}
authresponse=requests.post(authURL, json= auth_req_data)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
print(authresponse)
if authresponse.status_code != 200 or 'authorization' not in authresponse.headers:
sys.exit("Authentication failed (HTTP " + str(authresponse.status_code) + "). URL: " + authURL + " Response: " + authresponse.text)
return authresponse.headers["authorization"]


Expand Down Expand Up @@ -732,6 +740,8 @@ def buildLostRegistrationSpec(demographic_fields, document_fields, biometric_fie
print(get_schema_resp)
schema_resp_json=get_schema_resp.json()
schema_resp=schema_resp_json['response']
if schema_resp is None:
sys.exit("Failed to fetch identity schema from " + schemaURL + ". Response: " + json.dumps(schema_resp_json))
identity_schema_id=schema_resp['id']
cur_schema=schema_resp['schema']
domain='registration-client'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ ACTION=upgrade
UPGRADE_DOMAIN_NAME=
GLOBAL_ADMIN_USER=
GLOBAL_ADMIN_USER_PWD=
AUTH_APP_ID=admin
CLIENT_ID=
CLIENT_SECRET_KEY=
PRIMARY_LANGUAGE_CODE=
SECONDARY_LANGUAGE_CODE=
GENDER_DYNAMIC_FIELD_NAME=gender
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
python3 migration-ui_spec.py -d "$UPGRADE_DOMAIN_NAME" -u "$GLOBAL_ADMIN_USER" -p "$GLOBAL_ADMIN_USER_PWD" -pl "$PRIMARY_LANGUAGE_CODE" -sl "$SECONDARY_LANGUAGE_CODE" --identityMappingJsonUrl "$IDENTITY_MAPPING_JSON_URL" --ageGroupConfig "$AGEGROUP_CONFIG" --infantAgeGroup "$INFANT_AGEGROUP" --allowedBioAttributes "$ALLOWED_BIO_ATTRIBUTES"
python3 migration-ui_spec.py -d "$UPGRADE_DOMAIN_NAME" -u "$GLOBAL_ADMIN_USER" -p "$GLOBAL_ADMIN_USER_PWD" --appId "$AUTH_APP_ID" --clientId "$CLIENT_ID" --secretKey "$CLIENT_SECRET_KEY" -pl "$PRIMARY_LANGUAGE_CODE" -sl "$SECONDARY_LANGUAGE_CODE" --identityMappingJsonUrl "$IDENTITY_MAPPING_JSON_URL" --ageGroupConfig "$AGEGROUP_CONFIG" --infantAgeGroup "$INFANT_AGEGROUP" --allowedBioAttributes "$ALLOWED_BIO_ATTRIBUTES"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Outdated
python3 migration-dynamicfield.py "$SU_USER" "$SU_USER_PWD" "$DB_SERVERIP" "$DB_PORT" "$GENDER_DYNAMIC_FIELD_NAME" "$INDIVIDUAL_TYPE_DYNAMIC_FIELD_NAME"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --table "template_type" --operation "Insert" --autogen 0 --file "template_type_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --table "template" --operation "Insert" --dbusername "$SU_USER" --dbpassword "$SU_USER_PWD" --dbhost "$DB_SERVERIP" --dbport "$DB_PORT" --sheetname Sheet1 --idcolumn A --autogen 1 --file "template_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --table "machine_type" --operation "Insert" --dbusername "$SU_USER" --dbpassword "$SU_USER_PWD" --dbhost "$DB_SERVERIP" --dbport "$DB_PORT" --sheetname machine_type --autogen 0 --file "machine_type_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --table "machine_spec" --operation "Insert" --dbusername "$SU_USER" --dbpassword "$SU_USER_PWD" --dbhost "$DB_SERVERIP" --dbport "$DB_PORT" --sheetname machine_spec --autogen 0 --file "machine_spec_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --table "zone_user" --operation "Insert" --dbusername "$SU_USER" --dbpassword "$SU_USER_PWD" --dbhost "$DB_SERVERIP" --dbport "$DB_PORT" --sheetname zone_user --autogen 0 --file "zone_user_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --appId "$AUTH_APP_ID" --clientId "$CLIENT_ID" --secretKey "$CLIENT_SECRET_KEY" --table "template_type" --operation "Insert" --autogen 0 --file "template_type_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --appId "$AUTH_APP_ID" --clientId "$CLIENT_ID" --secretKey "$CLIENT_SECRET_KEY" --table "template" --operation "Insert" --dbusername "$SU_USER" --dbpassword "$SU_USER_PWD" --dbhost "$DB_SERVERIP" --dbport "$DB_PORT" --sheetname Sheet1 --idcolumn A --autogen 1 --file "template_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --appId "$AUTH_APP_ID" --clientId "$CLIENT_ID" --secretKey "$CLIENT_SECRET_KEY" --table "machine_type" --operation "Insert" --dbusername "$SU_USER" --dbpassword "$SU_USER_PWD" --dbhost "$DB_SERVERIP" --dbport "$DB_PORT" --sheetname machine_type --autogen 0 --file "machine_type_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --appId "$AUTH_APP_ID" --clientId "$CLIENT_ID" --secretKey "$CLIENT_SECRET_KEY" --table "machine_spec" --operation "Insert" --dbusername "$SU_USER" --dbpassword "$SU_USER_PWD" --dbhost "$DB_SERVERIP" --dbport "$DB_PORT" --sheetname machine_spec --autogen 0 --file "machine_spec_delta.xlsx"
python3 data-uploader.py --domain "$UPGRADE_DOMAIN_NAME" --username "$GLOBAL_ADMIN_USER" --password "$GLOBAL_ADMIN_USER_PWD" --appId "$AUTH_APP_ID" --clientId "$CLIENT_ID" --secretKey "$CLIENT_SECRET_KEY" --table "zone_user" --operation "Insert" --dbusername "$SU_USER" --dbpassword "$SU_USER_PWD" --dbhost "$DB_SERVERIP" --dbport "$DB_PORT" --sheetname zone_user --autogen 0 --file "zone_user_delta.xlsx"
Loading