lib/gooddata/lcm/actions/create_segment_masters.rb in gooddata-0.6.53 vs lib/gooddata/lcm/actions/create_segment_masters.rb in gooddata-0.6.54

- old
+ new

@@ -30,10 +30,13 @@ description 'Tokens' param :tokens, instance_of(Type::TokensType), required: true description 'Table Name' param :release_table_name, instance_of(Type::StringType), required: false + + description 'Project Environment' + param :project_environment, instance_of(Type::StringType), required: false end DEFAULT_TABLE_NAME = 'LCM_RELEASE' class << self @@ -43,11 +46,12 @@ client = params.gdc_gd_client development_client = params.development_client domain_name = params.organization || params.domain domain = client.domain(domain_name) || fail("Invalid domain name specified - #{domain_name}") - domain_segments = domain.segments + data_product = params.data_product + domain_segments = domain.segments(:all, data_product) # TODO: Support for 'per segment' provisioning segments = params.segments synchronize_projects = segments.map do |segment_in| # rubocop:disable Metrics/BlockLength @@ -69,18 +73,18 @@ ds.segment_id == segment_id end # Create new master project params.gdc_logger.info "Creating master project - name: '#{master_name}' development_project: '#{development_pid}', segment: '#{segment_id}', driver: '#{driver}'" - project = client.create_project(title: master_name, auth_token: token, driver: driver == 'vertica' ? 'vertica' : 'Pg') + project = client.create_project(title: master_name, auth_token: token, driver: driver == 'vertica' ? 'vertica' : 'Pg', environment: params.project_environment) # Does segment exists? If not, create new one and set initial master if segment segment_in[:is_new] = false status = 'untouched' else params.gdc_logger.info "Creating segment #{segment_id}, master #{project.pid}" - segment = domain.create_segment(segment_id: segment_id, master_project: project) + segment = data_product.create_segment(segment_id: segment_id, master_project: project) segment.synchronize_clients segment_in[:is_new] = true status = 'created' end