gooddata 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/.document +0 -0
  3. data/.gitignore +3 -0
  4. data/.rubocop.yml +0 -3
  5. data/.travis.yml +31 -21
  6. data/.yardopts +0 -0
  7. data/CHANGELOG.md +28 -0
  8. data/CLI.md +0 -0
  9. data/CONTRIBUTING.md +3 -0
  10. data/Dockerfile +7 -9
  11. data/Dockerfile.jruby +1 -0
  12. data/Guardfile +0 -0
  13. data/Jenkinsfile +18 -0
  14. data/Rakefile +25 -8
  15. data/TODO.md +0 -0
  16. data/bin/hello_world.sh +3 -0
  17. data/bin/provisioning.sh +3 -0
  18. data/bin/release.sh +3 -0
  19. data/bin/rollout.sh +3 -0
  20. data/bin/run_brick.rb +7 -7
  21. data/bin/user_filters.sh +3 -0
  22. data/bin/users.sh +3 -0
  23. data/dependency_decisions.yml +0 -0
  24. data/gooddata.gemspec +1 -1
  25. data/lib/gooddata/commands/process.rb +1 -1
  26. data/lib/gooddata/helpers/crypto_helper.rb +51 -0
  27. data/lib/gooddata/helpers/global_helpers.rb +2 -8
  28. data/lib/gooddata/lcm/actions/collect_segments.rb +2 -1
  29. data/lib/gooddata/lcm/actions/collect_users_brick_users.rb +14 -3
  30. data/lib/gooddata/lcm/actions/create_segment_masters.rb +4 -1
  31. data/lib/gooddata/lcm/actions/synchronize_processes.rb +6 -1
  32. data/lib/gooddata/lcm/actions/synchronize_user_filters.rb +0 -2
  33. data/lib/gooddata/lcm/types/complex/segment.rb +6 -0
  34. data/lib/gooddata/lcm/types/complex/synchronization_info.rb +3 -0
  35. data/lib/gooddata/mixins/is_folder.rb +0 -0
  36. data/lib/gooddata/mixins/to_json.rb +0 -0
  37. data/lib/gooddata/mixins/uri_getter.rb +0 -0
  38. data/lib/gooddata/models/domain.rb +1 -2
  39. data/lib/gooddata/models/project.rb +7 -5
  40. data/lib/gooddata/models/user_filters/user_filter_builder.rb +7 -2
  41. data/lib/gooddata/rest/README.md +0 -0
  42. data/lib/gooddata/rest/client.rb +6 -3
  43. data/lib/gooddata/version.rb +1 -1
  44. data/lib/templates/bricks/brick.rb.erb +0 -0
  45. data/lib/templates/bricks/main.rb.erb +0 -0
  46. data/lib/templates/project/Goodfile.erb +0 -0
  47. data/lib/templates/project/data/commits.csv +0 -0
  48. data/lib/templates/project/data/devs.csv +0 -0
  49. data/lib/templates/project/data/repos.csv +0 -0
  50. data/lib/templates/project/model/model.rb.erb +0 -0
  51. metadata +20 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78388b62f10692bc8416395774aad6f3d4020b39
4
- data.tar.gz: 925461dba225f4b742734c96a423fec33fca818a
3
+ metadata.gz: e42a132c41968e4869171cd83833ddd435d003f0
4
+ data.tar.gz: 5f57d656cdac4d45901f36a621b57404e109f80e
5
5
  SHA512:
6
- metadata.gz: 4c50cccdecccfd33eb03bbd40e9d129e413d2a02a3ba5ee96f4a0e76c16f4007747fa697e6065480875d283f5f5169b3d21ccd920ca0880049d50fbd27030baf
7
- data.tar.gz: ec7eb3f19ed6cad1915eb30133305ea2c97f052d5dfd1bd8a6f9897ebbd069c565d68d250cf518ee35ac6450edf283e33cd76811e4fd59ba94670bcf8bcfd2c4
6
+ metadata.gz: c5c2cceaded37c876c3dafcf0999027aed0f2aeb9a8dd8620b99ff913b5c03d5facdfd3af81e4002ff87ada7d9f1dcb25230e566711ebf17d145178a2d885059
7
+ data.tar.gz: cf6c751bffac63afc799a6ac24ee3698417ec247067ea6c72db8db3916dd2cefc83c6b9b99de62ad23003ae3c55c758aef8ace3d08f31083ba1c9946bf4a1c84
data/.document CHANGED
File without changes
data/.gitignore CHANGED
@@ -41,3 +41,6 @@ junit.xml
41
41
  # autogenerated file
42
42
  deprecations.txt
43
43
  .vscode/settings.json
44
+
45
+ # test cache files
46
+ ./spec/cache/
@@ -90,9 +90,6 @@ SignalException:
90
90
  TimesMap:
91
91
  Enabled: false
92
92
 
93
- UnneededDisable:
94
- Enabled: false
95
-
96
93
  UnneededInterpolation:
97
94
  Enabled: false
98
95
 
@@ -1,26 +1,36 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  stages:
4
- - unit
5
- - name: integration
6
- if: type = api
4
+ - unit
5
+ - name: integration
6
+ if: type IN (api, cron)
7
7
  jobs:
8
8
  include:
9
- - stage: unit
10
- script: bundle exec rake test:unit
11
- rvm:
12
- - 2.2
13
- - jruby-9.1.7
14
- - stage: integration
15
- script: |
16
- bundle exec rake -f lcm.rake docker:build
17
- bundle exec rake -f lcm.rake docker:bundle
18
- bundle exec rake -f lcm.rake test:integration:docker
19
- rvm:
20
- - jruby-9.1.7
21
- - stage: integration
22
- script: bundle exec rake test:sdk
23
- rvm: jruby-9.1.7
24
- - stage: integration
25
- script: bundle exec rake test:project
26
- rvm: jruby-9.1.7
9
+ - stage: unit
10
+ name: unit tests
11
+ script: bundle exec rake test:unit
12
+ rvm:
13
+ - 2.3
14
+ - jruby-9.1.7
15
+ - stage: unit
16
+ name: pronto code review
17
+ script: |
18
+ git remote add upstream https://github.com/gooddata/gooddata-ruby.git
19
+ git fetch upstream master
20
+ bundle exec pronto run -c upstream/master --exit-code
21
+ - stage: integration
22
+ name: lcm integration tests
23
+ script: |
24
+ bundle exec rake -f lcm.rake docker:build
25
+ bundle exec rake -f lcm.rake docker:bundle
26
+ bundle exec rake -f lcm.rake test:integration:docker
27
+ rvm:
28
+ - jruby-9.1.7
29
+ - stage: integration
30
+ name: sdk integration tests
31
+ script: bundle exec rake test:sdk
32
+ rvm: jruby-9.1.7
33
+ - stage: integration
34
+ name: sdk integration tests (project)
35
+ script: bundle exec rake test:project
36
+ rvm: jruby-9.1.7
data/.yardopts CHANGED
File without changes
@@ -1,4 +1,32 @@
1
1
  # GoodData Ruby SDK Changelog
2
+ ## 1.3.2
3
+ - Add rake task for changelog preview
4
+ - added possibility to run tests on PI
5
+ - TMA-1025: Parametrize output stage prefix
6
+ - TMA-1002 fix test run and added abbility to recover from mandatory projects delete
7
+ - Remove secret from .travis.yml
8
+ - Dont swallow error in .decrypt
9
+ - Properly escape secret in .travis.yml
10
+ - Update ruby in .travis.yml to 2.3
11
+ - Fix travis secret
12
+ - FEATURE: TMA-1034 Create image build pipeline
13
+ - TMA-1033: report pid in case of UFB failure
14
+ - Name travis build stages
15
+ - TMA-801: Update rubocop
16
+ - FEATURE: TMA-1052 Create execution script for each brick
17
+ - TMA-1081: fail UFB when multiple_project mode column is missing from UB input
18
+ - Enable running tests using cron in travis
19
+ - Reduce log size
20
+ - Set $HOME to writable directory
21
+ - Run pronto in travis
22
+ - TRIVIAL: Correct Ruby version used in brick Dockerfile
23
+ - FEATURE: TMA-1052 Change parameters passing
24
+ - TMA-1078: Generate stronger passwords
25
+ - Set correct default password
26
+ - TMA-986 fix random user selection in user filters test
27
+ - TMA-1005: Rotate test user password
28
+ - TMA-1005: Add description for rake password:rotate
29
+
2
30
  ## 1.3.1
3
31
  - FEATURE: TMA-1030 Raise jruby version used in K8s docker image (#1284)
4
32
  - Update README.md
data/CLI.md CHANGED
File without changes
@@ -19,6 +19,9 @@ describe 'New integration test', :vcr
19
19
  The VCR `record` mode can be set via `VCR_RECORD_MODE` environment variable. Set it to `all` to make a new recording.
20
20
  Please check the recorded payloads for possible sensitive data before submitting to github.
21
21
 
22
+ #### PI test setup
23
+ If you are so lucky and have acces to PI, you can run the test agains it ... there is guide in [confluence](https://confluence.intgdc.com/display/SCRUM/Running+Tests+on+PI)
24
+
22
25
  ## Static analysis
23
26
  We use [Pronto](https://github.com/prontolabs/pronto) to detect code smells using static analysis. Comments are automatically created on pull requests when code smells are found.
24
27
 
data/Dockerfile CHANGED
@@ -1,11 +1,11 @@
1
1
  FROM harbor.intgdc.com/tools/gdc-java-8-jre:b057b53
2
2
 
3
- MAINTAINER LCM <lcm@gooddata.com>
4
-
3
+ ARG GIT_COMMIT=unspecified
5
4
  LABEL image_name="GDC LCM Bricks"
6
5
  LABEL maintainer="LCM <lcm@gooddata.com>"
7
- LABEL git_repostiory_url="https://github.com/gooddata/gooddata-ruby/"
6
+ LABEL git_repository_url="https://github.com/gooddata/gooddata-ruby/"
8
7
  LABEL parent_image="harbor.intgdc.com/tools/gdc-java-8-jre:b057b53"
8
+ LABEL git_commit=$GIT_COMMIT
9
9
 
10
10
  # which is required by RVM
11
11
  RUN yum install -y curl which \
@@ -13,17 +13,17 @@ RUN yum install -y curl which \
13
13
  && rm -rf /var/cache/yum
14
14
 
15
15
  RUN gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
16
- RUN curl -sSL https://get.rvm.io | bash -s stable --ruby=jruby-9.1.14
16
+ RUN curl -sSL https://get.rvm.io | bash -s stable --ruby=jruby-9.1.14.0
17
17
 
18
18
  # Switch to directory with sources
19
19
  WORKDIR /src
20
+ ENV HOME=/src
20
21
 
21
22
  # login shell is required by rvm
22
23
  RUN /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && gem update --system \
23
24
  && gem install bundler rake"
24
25
 
25
- ARG SOURCE_COMMIT
26
- ENV GOODDATA_RUBY_COMMIT=$SOURCE_COMMIT
26
+ ENV GOODDATA_RUBY_COMMIT=$GIT_COMMIT
27
27
 
28
28
  ADD ./bin ./bin
29
29
  ADD ./lib ./lib
@@ -32,6 +32,4 @@ ADD ./gooddata.gemspec .
32
32
 
33
33
  RUN /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && bundle install"
34
34
 
35
- ENTRYPOINT ["/bin/bash", "-l", "-c"]
36
-
37
- CMD [ ". /usr/local/rvm/scripts/rvm && bundle exec ./bin/run_brick.rb" ]
35
+ CMD [ "./bin/hello_world.sh" ]
@@ -6,6 +6,7 @@ RUN apk add --no-cache curl make gcc git g++ python linux-headers binutils-gold
6
6
 
7
7
  # Switch to directory with sources
8
8
  WORKDIR /src
9
+ ENV HOME=/src
9
10
 
10
11
  RUN gem update --system \
11
12
  && gem install bundler
data/Guardfile CHANGED
File without changes
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (C) 2007-2018, GoodData(R) Corporation. All rights reserved.
3
+ */
4
+
5
+ @Library('pipelines-shared-libs')
6
+ import com.gooddata.pipeline.Pipeline
7
+
8
+ def config = [
9
+ 'microservices': [
10
+ 'lcm-bricks': [
11
+ 'docker': [
12
+ 'dockerfile': './Dockerfile'
13
+ ]
14
+ ]
15
+ ]
16
+ ]
17
+
18
+ Pipeline.get(this, config).run()
data/Rakefile CHANGED
@@ -145,23 +145,34 @@ end
145
145
 
146
146
  # Updates the changelog with commit messages
147
147
  def update_changelog(new_version)
148
- changelog = File.read('CHANGELOG.md')
149
- changelog_header = '# GoodData Ruby SDK Changelog'
150
- changelog.slice! changelog_header
148
+ changelog = headless_changelog
151
149
  fail 'the version is already mentioned in the changelog' if changelog =~ /## #{new_version}/
152
150
  puts "Creating changelog for version #{new_version}"
153
- current_commit = `git rev-parse HEAD`.chomp
154
- last_release = changelog.split("\n").reject(&:empty?).first.delete('## ').chomp
155
- last_release_commit = `git rev-parse #{last_release}`.chomp
156
- changes = `git log --format=%s --no-merges #{last_release_commit}..#{current_commit}`.split("\n").reject(&:empty?)
157
151
  File.open('CHANGELOG.md', 'w+') do |file|
158
152
  file.puts changelog_header + "\n"
159
153
  file.puts "## #{new_version}"
160
- changes.each { |change| file.puts ' - ' + change }
154
+ changes(changelog).each { |change| file.puts ' - ' + change }
161
155
  file.puts changelog
162
156
  end
163
157
  end
164
158
 
159
+ def changes(changelog)
160
+ current_commit = `git rev-parse HEAD`.chomp
161
+ last_release = changelog.split("\n").reject(&:empty?).first.delete('## ').chomp
162
+ last_release_commit = `git rev-parse #{last_release}`.chomp
163
+ `git log --format=%s --no-merges #{last_release_commit}..#{current_commit}`.split("\n").reject(&:empty?)
164
+ end
165
+
166
+ def headless_changelog
167
+ changelog = File.read('CHANGELOG.md')
168
+ changelog.slice! changelog_header
169
+ changelog
170
+ end
171
+
172
+ def changelog_header
173
+ '# GoodData Ruby SDK Changelog'
174
+ end
175
+
165
176
  namespace :version do
166
177
  desc 'Updates the changelog, commits and tags the bump'
167
178
  task :bump do
@@ -172,6 +183,11 @@ namespace :version do
172
183
  `git commit -m "Bump version to #{new_version}"`
173
184
  `git tag #{new_version}`
174
185
  end
186
+
187
+ desc 'Shows changes since last release'
188
+ task :changelog do
189
+ puts changes(headless_changelog)
190
+ end
175
191
  end
176
192
 
177
193
  RSpec::Core::RakeTask.new(:test)
@@ -226,6 +242,7 @@ namespace :gitflow do
226
242
  end
227
243
  end
228
244
 
245
+ desc 'Rotates the password of the test domain admin'
229
246
  namespace :password do
230
247
  task :rotate, [:value, :encryption_key] do |_, args|
231
248
  key = 'password'
data/TODO.md CHANGED
File without changes
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && bundle exec ./bin/run_brick.rb hello_world_brick"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && bundle exec ./bin/run_brick.rb provisioning_brick"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && bundle exec ./bin/run_brick.rb release_brick"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && bundle exec ./bin/run_brick.rb rollout_brick"
@@ -4,22 +4,22 @@ require 'remote_syslog_logger'
4
4
  require_relative '../lib/gooddata'
5
5
 
6
6
  DEFAULT_BRICK = 'hello_world_brick'
7
+ BRICK_PARAM_PREFIX = 'BRICK_PARAM_'
7
8
 
8
- brick_type = ENV['BRICK_TYPE'] || DEFAULT_BRICK
9
+ brick_type = !ARGV.empty? ? ARGV[0] : DEFAULT_BRICK
9
10
 
10
11
  syslog_node = ENV['NODE_NAME']
11
12
  log = RemoteSyslogLogger.new(syslog_node, 514, :program => brick_type)
12
13
 
13
- log.info "action=#{brick_type}_execution status=start"
14
+ log.info "action=#{brick_type}_execution status=init"
14
15
 
15
16
  begin
16
17
  brick_pipeline = GoodData::Bricks::Pipeline.send("#{brick_type}_pipeline")
17
- params_json = ENV['BRICK_PARAMS_JSON']
18
- params = params_json.nil? ? {} : JSON.parse(params_json)
19
-
20
- params['gooddata_ruby_commit'] = ENV['GOODDATA_RUBY_COMMIT'] || '<unknown>'
18
+ params = ENV.select { |k,| k.to_s.match(/^#{BRICK_PARAM_PREFIX}.*/) }.map { |k, v| [k.slice(BRICK_PARAM_PREFIX.length..-1), v] }.to_h
19
+ commit_hash = ENV['GOODDATA_RUBY_COMMIT'] || ''
20
+ params['gooddata_ruby_commit'] = commit_hash
21
21
  params['log_directory'] = ENV['LOG_DIRECTORY'] || '/tmp/'
22
-
22
+ log.info "action=#{brick_type}_execution status=start commit_hash=#{commit_hash}"
23
23
  @brick_result = brick_pipeline.call(params)
24
24
  log.info "action=#{brick_type}_execution status=finished"
25
25
  rescue NoMethodError => e
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && bundle exec ./bin/run_brick.rb user_filters_brick"
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env bash
2
+
3
+ /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && bundle exec ./bin/run_brick.rb users_brick"
File without changes
@@ -35,7 +35,7 @@ Gem::Specification.new do |s|
35
35
  s.add_development_dependency 'rspec', '~> 3.5'
36
36
  s.add_development_dependency 'rspec-expectations', '~> 3.5'
37
37
  s.add_development_dependency 'rspec_junit_formatter', '~> 0.3.0'
38
- s.add_development_dependency 'rubocop', '< 0.48' # TODO: remove it after dealing with new rules introduced in 0.48 version
38
+ s.add_development_dependency 'rubocop', '~> 0.59.1'
39
39
  s.add_development_dependency 'simplecov', '~> 0.12'
40
40
  s.add_development_dependency 'webmock', '~> 2.3.1'
41
41
  s.add_development_dependency 'yard', '~> 0.9.11'
@@ -56,7 +56,7 @@ module GoodData
56
56
  verbose = options[:v]
57
57
  dir = Pathname(dir)
58
58
  name = options[:name] || "Temporary deploy[#{dir}][#{options[:project_name]}]"
59
- GoodData::Process.with_deploy(dir, options.merge(:name => name, :project_id => ProjectHelper::PROJECT_ID)) do |process|
59
+ GoodData::Process.with_deploy(dir, options.merge(:name => name, :project_id => ProjectHelper.project_id(options[:client]))) do |process|
60
60
  puts HighLine.color('Executing', HighLine::BOLD) if verbose
61
61
  process.execute(executable, options)
62
62
  end
@@ -0,0 +1,51 @@
1
+ # encoding: UTF-8
2
+ #
3
+ # Copyright (c) 2010-2018 GoodData Corporation. All rights reserved.
4
+ # This source code is licensed under the BSD-style license found in the
5
+ # LICENSE file in the root directory of this source tree.
6
+
7
+ require 'securerandom'
8
+
9
+ module GoodData
10
+ module Helpers
11
+ module CryptoHelper
12
+ class << self
13
+ def generate_password
14
+ sprinkle(SecureRandom.base64(32))
15
+ end
16
+
17
+ private
18
+
19
+ # Pseudo-randomly "sprinkles" the given string
20
+ # with 4 character groups (digit, lower case,
21
+ # upper case, symbols).
22
+ # @param [String] password
23
+ def sprinkle(password)
24
+ password_dup = password.dup
25
+ positions = 0..password.size
26
+ password_dup.insert(rand(positions), digit)
27
+ password_dup.insert(rand(positions), lower)
28
+ password_dup.insert(rand(positions), upper)
29
+ password_dup.insert(rand(positions), symbol)
30
+ password_dup
31
+ end
32
+
33
+ def digit
34
+ (0..9).to_a.sample.to_s
35
+ end
36
+
37
+ def lower
38
+ ('a'..'z').to_a.sample
39
+ end
40
+
41
+ def upper
42
+ ('A'..'Z').to_a.sample
43
+ end
44
+
45
+ def symbol
46
+ '!@#$%&/()+?*'.chars.sample
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -241,14 +241,8 @@ module GoodData
241
241
  random_iv = data[0..15] # extract iv from first 16 bytes
242
242
  data = data[16..data.size - 1]
243
243
  cipher.iv = Digest::SHA256.digest(random_iv + cipher_key)[0..15]
244
- begin
245
- decrypted = cipher.update(data)
246
- decrypted << cipher.final
247
- rescue
248
- puts 'Error'
249
- return nil
250
- end
251
-
244
+ decrypted = cipher.update(data)
245
+ decrypted << cipher.final
252
246
  decrypted
253
247
  end
254
248
  end
@@ -35,7 +35,8 @@ module GoodData
35
35
  def call(params)
36
36
  data_product = params.data_product
37
37
  data_product_segments = data_product.segments
38
- params.gdc_logger.info("Domain segments: #{data_product_segments}")
38
+ segment_names = data_product_segments.map(&:segment_id)
39
+ params.gdc_logger.debug("Domain segments: #{segment_names}")
39
40
 
40
41
  if params.segments_filter
41
42
  params.gdc_logger.info("Segments filter: #{params.segments_filter}")
@@ -21,8 +21,17 @@ module GoodData
21
21
 
22
22
  description 'Input Source'
23
23
  param :input_source, instance_of(Type::HashType), required: false
24
+
25
+ description 'Synchronization Mode (e.g. sync_one_project_based_on_pid)'
26
+ param :sync_mode, instance_of(Type::StringType), required: false, default: 'sync_project'
24
27
  end
25
28
 
29
+ MULTIPLE_COLUMN_MODES = %w(
30
+ sync_domain_client_workspaces
31
+ sync_multiple_projects_based_on_custom_id
32
+ sync_multiple_projects_based_on_pid
33
+ )
34
+
26
35
  class << self
27
36
  def call(params)
28
37
  users_brick_users = []
@@ -39,12 +48,14 @@ module GoodData
39
48
  headers: true,
40
49
  return_headers: false,
41
50
  encoding: 'utf-8') do |row|
51
+ pid = row[params.multiple_projects_column]
52
+ fail "The set multiple_projects_column '#{params.multiple_projects_column}' of the users input is empty" if !pid && MULTIPLE_COLUMN_MODES.include?(params.sync_mode)
53
+
42
54
  users_brick_users << {
43
- login: row[login_column],
44
- pid: row[params.multiple_projects_column]
55
+ login: row[login_column].downcase,
56
+ pid: pid
45
57
  }
46
58
  end
47
-
48
59
  {
49
60
  # TODO; TMA-989 return the real results when print of results is fixed for large sets
50
61
  results: [{ status: 'ok' }],
@@ -68,6 +68,7 @@ module GoodData
68
68
  driver = segment_in.driver.downcase
69
69
  token = params.tokens[driver.to_sym] || fail("Token for driver '#{driver}' was not specified")
70
70
  ads_output_stage_uri = segment_in.ads_output_stage_uri
71
+ ads_output_stage_prefix = segment_in.ads_output_stage_prefix
71
72
 
72
73
  # Create master project Postgres
73
74
  version = get_project_version(params, segment_id) + 1
@@ -126,6 +127,7 @@ module GoodData
126
127
  development_pid: development_pid,
127
128
  master_pid: project.pid,
128
129
  ads_output_stage_uri: ads_output_stage_uri,
130
+ ads_output_stage_prefix: ads_output_stage_prefix,
129
131
  driver: driver,
130
132
  status: status
131
133
  }
@@ -134,7 +136,8 @@ module GoodData
134
136
  segment: segment_id,
135
137
  from: development_pid,
136
138
  to: [{ pid: project.pid }],
137
- ads_output_stage_uri: ads_output_stage_uri
139
+ ads_output_stage_uri: ads_output_stage_uri,
140
+ ads_output_stage_prefix: ads_output_stage_prefix
138
141
  }
139
142
  end
140
143
 
@@ -55,7 +55,12 @@ module GoodData
55
55
  to_project = client.projects(pid) || fail("Invalid 'to' project specified - '#{pid}'")
56
56
 
57
57
  params.gdc_logger.info "Transferring processes, from project: '#{from.title}', PID: '#{from.pid}', to project: '#{to_project.title}', PID: '#{to_project.pid}'"
58
- res = GoodData::Project.transfer_processes(from, to_project, ads_output_stage_uri: info.ads_output_stage_uri)
58
+ res = GoodData::Project.transfer_processes(
59
+ from,
60
+ to_project,
61
+ ads_output_stage_uri: info.ads_output_stage_uri,
62
+ ads_output_stage_prefix: info.ads_output_stage_prefix
63
+ )
59
64
 
60
65
  to_project.add.output_stage.client_id = client_id if client_id && to_project.add.output_stage
61
66
 
@@ -78,9 +78,7 @@ module GoodData
78
78
 
79
79
  class << self
80
80
  MODES = %w(
81
- add_to_organization
82
81
  sync_project
83
- sync_domain_and_project
84
82
  sync_multiple_projects_based_on_pid
85
83
  sync_one_project_based_on_pid
86
84
  sync_one_project_based_on_custom_id
@@ -29,6 +29,12 @@ module GoodData
29
29
 
30
30
  description 'Production Tag Names'
31
31
  param :production_tags, array_of(instance_of(Type::StringType)), required: false
32
+
33
+ description 'Uri of the source output stage. It must be in the same domain as the target project.'
34
+ param :ads_output_stage_uri, instance_of(Type::StringType), required: false
35
+
36
+ description 'Custom prefix for the target output stage.'
37
+ param :ads_output_stage_prefix, instance_of(Type::StringType), required: false
32
38
  end
33
39
 
34
40
  def check(value)
@@ -24,6 +24,9 @@ module GoodData
24
24
 
25
25
  description 'Uri of the source output stage. It must be in the same domain as the target project.'
26
26
  param :ads_output_stage_uri, instance_of(Type::StringType), required: false
27
+
28
+ description 'Custom prefix for the target output stage.'
29
+ param :ads_output_stage_prefix, instance_of(Type::StringType), required: false
27
30
  end
28
31
 
29
32
  def check(value)
File without changes
File without changes
File without changes
@@ -45,7 +45,7 @@ module GoodData
45
45
  # @param password [String] Default preset password
46
46
  # @return [Object] Raw response
47
47
  def add_user(user_data, name = nil, opts = { :client => GoodData.connection })
48
- generated_pass = rand(10E10).to_s
48
+ generated_pass = GoodData::Helpers::CryptoHelper.generate_password
49
49
  domain_name = name || user_data[:domain]
50
50
  user_data = user_data.to_hash
51
51
  data = {
@@ -135,7 +135,6 @@ module GoodData
135
135
  user_data = user_data.to_hash if user_data.is_a?(GoodData::Profile)
136
136
  client = client(options)
137
137
  user_data = user_data.to_hash
138
- # generated_pass = rand(10E10).to_s
139
138
  data = {
140
139
  :firstName => user_data[:first_name] || 'FirstName',
141
140
  :lastName => user_data[:last_name] || 'LastName',
@@ -195,13 +195,15 @@ module GoodData
195
195
  end
196
196
 
197
197
  def transfer_output_stage(from_project, to_project, options)
198
+ from_prj_output_stage = from_project.add.output_stage
199
+ output_stage_prefix = options[:ads_output_stage_prefix] || from_prj_output_stage.output_stage_prefix
200
+ output_stage_uri = options[:ads_output_stage_uri] || from_prj_output_stage.schema
198
201
  if from_project.processes.any? { |p| p.type == :dataload }
199
202
  if to_project.processes.any? { |p| p.type == :dataload }
200
- to_project.add.output_stage.schema = from_project.add.output_stage.schema
201
- to_project.add.output_stage.output_stage_prefix = from_project.add.output_stage.output_stage_prefix
203
+ to_project.add.output_stage.schema = output_stage_uri
204
+ to_project.add.output_stage.output_stage_prefix = output_stage_prefix
202
205
  to_project.add.output_stage.save
203
206
  else
204
- from_prj_output_stage = from_project.add.output_stage
205
207
  from_server = from_project.client.connection.server.url
206
208
  to_server = to_project.client.connection.server.url
207
209
  if from_server != to_server && options[:ads_output_stage_uri].nil?
@@ -214,9 +216,9 @@ module GoodData
214
216
 
215
217
  to_project.add.output_stage = GoodData::AdsOutputStage.create(
216
218
  client: to_project.client,
217
- ads: options[:ads_output_stage_uri] || from_prj_output_stage.schema,
219
+ ads: output_stage_uri,
218
220
  client_id: from_prj_output_stage.client_id,
219
- output_stage_prefix: from_prj_output_stage.output_stage_prefix,
221
+ output_stage_prefix: output_stage_prefix,
220
222
  project: to_project
221
223
  )
222
224
  end
@@ -390,12 +390,17 @@ module GoodData
390
390
  project_users = project.users
391
391
  filters = normalize_filters(user_filters)
392
392
  user_filters, errors = maqlify_filters(filters, project_users, options.merge(users_must_exist: users_must_exist, type: :muf))
393
+ if !ignore_missing_values && !errors.empty?
394
+ errors = errors.map do |e|
395
+ e.merge(pid: project.pid)
396
+ end
397
+ fail GoodData::FilterMaqlizationError, errors
398
+ end
393
399
 
394
- fail GoodData::FilterMaqlizationError, errors if !ignore_missing_values && !errors.empty?
395
400
  filters = user_filters.map { |data| client.create(MandatoryUserFilter, data, project: project) }
396
401
  to_create, to_delete = resolve_user_filters(filters, project.data_permissions)
397
402
 
398
- to_delete = sanitize_filters_to_delete(to_delete, options[:users_brick_input], project_users)
403
+ to_delete = sanitize_filters_to_delete(to_delete, options[:users_brick_input], project_users) unless options[:no_sanitize]
399
404
 
400
405
  if options[:do_not_touch_filters_that_are_not_mentioned]
401
406
  GoodData.logger.warn("Data permissions computed: #{to_create.count} to create")
File without changes
@@ -169,9 +169,12 @@ module GoodData
169
169
  end
170
170
 
171
171
  def project_is_accessible?(id)
172
- projects(id) && true
173
- rescue
174
- true
172
+ GoodData.logger.warn 'Beware! project_is_accessible is deprecated and should not be used.'
173
+ begin # rubocop:disable RedundantBegin TODO: remove this after droping JRuby which does not support rescue without begin
174
+ projects(id)
175
+ rescue RestClient::NotFound
176
+ false
177
+ end
175
178
  end
176
179
 
177
180
  def projects(id = :all)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # GoodData Module
8
8
  module GoodData
9
- VERSION = '1.3.1'
9
+ VERSION = '1.3.2'
10
10
 
11
11
  class << self
12
12
  # Version
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kolesnikov
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-09-17 00:00:00.000000000 Z
14
+ date: 2018-10-05 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: bundler
@@ -115,16 +115,16 @@ dependencies:
115
115
  name: rubocop
116
116
  requirement: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - "<"
118
+ - - "~>"
119
119
  - !ruby/object:Gem::Version
120
- version: '0.48'
120
+ version: 0.59.1
121
121
  type: :development
122
122
  prerelease: false
123
123
  version_requirements: !ruby/object:Gem::Requirement
124
124
  requirements:
125
- - - "<"
125
+ - - "~>"
126
126
  - !ruby/object:Gem::Version
127
- version: '0.48'
127
+ version: 0.59.1
128
128
  - !ruby/object:Gem::Dependency
129
129
  name: simplecov
130
130
  requirement: !ruby/object:Gem::Requirement
@@ -543,7 +543,13 @@ email: pavel@gooddata.com
543
543
  executables:
544
544
  - gitflow-init.sh
545
545
  - gooddata
546
+ - hello_world.sh
547
+ - provisioning.sh
548
+ - release.sh
549
+ - rollout.sh
546
550
  - run_brick.rb
551
+ - user_filters.sh
552
+ - users.sh
547
553
  extensions: []
548
554
  extra_rdoc_files:
549
555
  - LICENSE
@@ -568,6 +574,7 @@ files:
568
574
  - Dockerfile.ruby
569
575
  - Gemfile
570
576
  - Guardfile
577
+ - Jenkinsfile
571
578
  - LICENSE
572
579
  - LICENSE.rb
573
580
  - README.md
@@ -577,7 +584,13 @@ files:
577
584
  - authors.sh
578
585
  - bin/gitflow-init.sh
579
586
  - bin/gooddata
587
+ - bin/hello_world.sh
588
+ - bin/provisioning.sh
589
+ - bin/release.sh
590
+ - bin/rollout.sh
580
591
  - bin/run_brick.rb
592
+ - bin/user_filters.sh
593
+ - bin/users.sh
581
594
  - ci.rake
582
595
  - data/2008.crt
583
596
  - data/new_ca.cer
@@ -677,6 +690,7 @@ files:
677
690
  - lib/gooddata/extract.rb
678
691
  - lib/gooddata/goodzilla/goodzilla.rb
679
692
  - lib/gooddata/helpers/auth_helpers.rb
693
+ - lib/gooddata/helpers/crypto_helper.rb
680
694
  - lib/gooddata/helpers/csv_helper.rb
681
695
  - lib/gooddata/helpers/data_helper.rb
682
696
  - lib/gooddata/helpers/erb_helper.rb