diff --git a/docker/archimedes-base/Dockerfile b/docker/archimedes-base/Dockerfile index 99a8de06b3..39f7b3be93 100644 --- a/docker/archimedes-base/Dockerfile +++ b/docker/archimedes-base/Dockerfile @@ -7,7 +7,7 @@ WORKDIR /app ENV DOCKER_VERSION 19.03.12 ENV PYTHON_VERSION 3.8 ENV DOCKERIZE_VERSION 0.5.0 -ENV POETRY_VERSION 1.1.4 +ENV POETRY_VERSION 1.1.15 ENV DOCKERIZE_URL https://github.com/jwilder/dockerize/releases/download/v${DOCKERIZE_VERSION}/dockerize-linux-amd64-v${DOCKERIZE_VERSION}.tar.gz ENV PATH "/app/bin:/opt/poetry/bin:$PATH" ENV POETRY_HOME "/opt/poetry" diff --git a/polyphemus/lib/commands.rb b/polyphemus/lib/commands.rb index 3250b2f2dd..d22721f1ee 100644 --- a/polyphemus/lib/commands.rb +++ b/polyphemus/lib/commands.rb @@ -310,7 +310,7 @@ def cascade_to_pool(base_model) update_request = Etna::Clients::Magma::UpdateRequest.new(project_name: project) update_request.update_revision("#{base_model}_pool", pool, restricted: true) - magma_client.update(update_request) + magma_client.update_json(update_request) else logger.info "#{base_model}_pool #{pool} does not include a restricted patient, relaxing." @@ -322,7 +322,7 @@ def cascade_to_pool(base_model) update_request = Etna::Clients::Magma::UpdateRequest.new(project_name: project) update_request.update_revision("#{base_model}_pool", pool, restricted: false) - magma_client.update(update_request) + magma_client.update_json(update_request) end end end @@ -341,7 +341,7 @@ def restrict!(patient, delete_metis_files: false) Rollbar.info("Attempting to restrict access to #{name}") update_request = Etna::Clients::Magma::UpdateRequest.new(project_name: project) update_request.update_revision('patient', name, restricted: true) - magma_client.update(update_request) + magma_client.update_json(update_request) end end @@ -362,7 +362,7 @@ def unrestrict!(patient) Rollbar.info("Attempting to unrestrict access to #{name}") update_request = Etna::Clients::Magma::UpdateRequest.new(project_name: project) update_request.update_revision('patient', name, restricted: false) - magma_client.update(update_request) + magma_client.update_json(update_request) end end diff --git a/polyphemus/spec/cascade_mvir_restricted_spec.rb b/polyphemus/spec/cascade_mvir_restricted_spec.rb index b85e5741de..78711e80d5 100644 --- a/polyphemus/spec/cascade_mvir_restricted_spec.rb +++ b/polyphemus/spec/cascade_mvir_restricted_spec.rb @@ -14,7 +14,7 @@ @all_updates = [] WebMock.disable_net_connect! - stub_magma_setup(patients_to_restrict) + stub_magma_setup(patients_to_restrict, use_json: true) stub_magma_restricted_pools('cytof', ['pool-a', 'pool-c']) stub_magma_all_pools('cytof', ['pool-a', 'pool-c']) stub_magma_restricted_pools('sc_rna_seq', ['pool-e', 'pool-f']) @@ -53,23 +53,23 @@ acc end).to eq({ "cytof_pool" => { - "pool-a" => {"restricted" => "true"}, - "pool-c" => {"restricted" => "true"} + "pool-a" => {"restricted" => true}, + "pool-c" => {"restricted" => true} }, "sc_rna_seq_pool" => { - "pool-e" => {"restricted" => "true"}, - "pool-f" => {"restricted" => "true"}, + "pool-e" => {"restricted" => true}, + "pool-f" => {"restricted" => true}, }, "patient" => { - "Mike" => {"restricted" => "true"}, - "Dan" => {"restricted" => "true"}, + "Mike" => {"restricted" => true}, + "Dan" => {"restricted" => true}, } }) end it 'correctly makes Metis calls to restrict patient and pool folders' do patients_to_restrict[:Dan][:consent] = 'No Samples/Data' - stub_magma_setup(patients_to_restrict) + stub_magma_setup(patients_to_restrict, use_json: true) stub_parent_exists({status: 422, bucket: RESTRICT_BUCKET}) stub_create_folder({bucket: RESTRICT_BUCKET}) @@ -119,7 +119,7 @@ it 'continues working if a single patient throws an error' do patients_to_restrict[:Dan][:consent] = 'No Samples/Data' - stub_magma_setup(patients_to_restrict) + stub_magma_setup(patients_to_restrict, use_json: true) stub_parent_exists({status: 422, bucket: RESTRICT_BUCKET}) stub_create_folder({bucket: RESTRICT_BUCKET}) stub_rename_folder_with_error({bucket: RELEASE_BUCKET}) @@ -176,7 +176,7 @@ WebMock.disable_net_connect! - stub_magma_setup(patients_to_release) + stub_magma_setup(patients_to_release, use_json: true) stub_magma_restricted_pools('cytof', []) stub_magma_restricted_pools('sc_rna_seq', []) stub_magma_all_pools('cytof', ['pool-b', 'pool-d']) @@ -210,15 +210,15 @@ acc end).to eq({ "cytof_pool" => { - "pool-b" => {"restricted" => "false"}, - "pool-d" => {"restricted" => "false"}, + "pool-b" => {"restricted" => false}, + "pool-d" => {"restricted" => false}, }, "sc_rna_seq_pool" => { - "pool-g" => {"restricted" => "false"}, - "pool-j" => {"restricted" => "false"}, + "pool-g" => {"restricted" => false}, + "pool-j" => {"restricted" => false}, }, "patient" => { - "Danielle" => {"restricted" => "false"}, + "Danielle" => {"restricted" => false}, } }) end diff --git a/polyphemus/spec/spec_helper.rb b/polyphemus/spec/spec_helper.rb index de41224ad1..6cad6e0424 100644 --- a/polyphemus/spec/spec_helper.rb +++ b/polyphemus/spec/spec_helper.rb @@ -182,7 +182,7 @@ def stub_magma_all_pools(base_model, all_pools) }.to_json }) end -def stub_magma_setup(patient_documents) +def stub_magma_setup(patient_documents, use_json: false) stub_request(:post, "#{MAGMA_HOST}/retrieve") .with(body: hash_including({ project_name: "mvir1", model_name: "patient", attribute_names: ["name", "consent", "restricted"], record_names: "all" })) @@ -190,7 +190,7 @@ def stub_magma_setup(patient_documents) 'models': { 'patient': { 'documents': patient_documents } }, }.to_json }) - stub_magma_update("mvir1") + use_json ? stub_magma_update_json : stub_magma_update("mvir1") end def stub_magma_update(project_name = nil) @@ -344,7 +344,11 @@ def stub_magma_models(fixture: "spec/fixtures/magma_test_models.json") def stub_magma_update_json stub_request(:post, /#{MAGMA_HOST}\/update$/) - .to_return({ status: 200, body: {}.to_json, headers: { 'Content-Type': "application/json" } }) + .to_return do |request| + params = JSON.parse(request.body) + @all_updates << params["revisions"] if @all_updates && params && params["revisions"] + { body: "{}", status: 200, headers: { 'Content-Type': "application/json" } } + end end def stub_redcap_data(stub = nil)