gooddata 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: e42a132c41968e4869171cd83833ddd435d003f0
4
- data.tar.gz: 5f57d656cdac4d45901f36a621b57404e109f80e
2
+ SHA256:
3
+ metadata.gz: 349861ea9b8d256231dd3e3bc41f2db25c8b757f066dad7cae3d113be9e5afcc
4
+ data.tar.gz: 6c470979756fa2584e6d7ae10b6de76160e3705f0ccd0c3de95405cbb1662de1
5
5
  SHA512:
6
- metadata.gz: c5c2cceaded37c876c3dafcf0999027aed0f2aeb9a8dd8620b99ff913b5c03d5facdfd3af81e4002ff87ada7d9f1dcb25230e566711ebf17d145178a2d885059
7
- data.tar.gz: cf6c751bffac63afc799a6ac24ee3698417ec247067ea6c72db8db3916dd2cefc83c6b9b99de62ad23003ae3c55c758aef8ace3d08f31083ba1c9946bf4a1c84
6
+ metadata.gz: 38e9044811de4851d3c988fdb6b87e093dbf40ae2fb947056f08107b614564f7cf9078f46465017a9c4554215194b1a7f69f029b8d86086163d2c9fc2174e359
7
+ data.tar.gz: d8574354704c95e2cf71623079f5b1eea5115e9bd889c61c321ca7e3c10504eac7883c77c7bfd2394d19505049cef9b840675eba0e7baf6192b66a469a376bc5
@@ -1,12 +1,9 @@
1
1
  root = true
2
2
 
3
- [*]
3
+ [*.rb]
4
4
  indent_style = space
5
5
  indent_size = 2
6
- end_of_line = lf
7
6
  charset = utf-8
7
+ end_of_line = lf
8
8
  trim_trailing_whitespace = true
9
9
  insert_final_newline = true
10
-
11
- [*.{sh,markdown}]
12
- indent_size = 4
data/.gitignore CHANGED
@@ -43,4 +43,4 @@ deprecations.txt
43
43
  .vscode/settings.json
44
44
 
45
45
  # test cache files
46
- ./spec/cache/
46
+ spec/cache/
@@ -1,24 +1,44 @@
1
1
  language: ruby
2
2
  cache: bundler
3
3
  stages:
4
- - unit
4
+ - name: unit
5
+ if: type IN (push, pull_request)
5
6
  - name: integration
6
- if: type IN (api, cron)
7
+ if: type IN (api)
8
+ - name: periodic
9
+ if: type IN (cron)
10
+ - name: cleanup
11
+ if: type IN (cron)
7
12
  jobs:
8
13
  include:
14
+ # unit
9
15
  - stage: unit
10
16
  name: unit tests
11
17
  script: bundle exec rake test:unit
12
18
  rvm:
13
19
  - 2.3
14
- - jruby-9.1.7
20
+ - 2.4
21
+ - 2.5
22
+ - jruby-9.1.5
23
+ - jruby-9.1.14
24
+ - jruby-1.7.19
15
25
  - stage: unit
16
26
  name: pronto code review
17
27
  script: |
18
28
  git remote add upstream https://github.com/gooddata/gooddata-ruby.git
19
29
  git fetch upstream master
20
30
  bundle exec pronto run -c upstream/master --exit-code
21
- - stage: integration
31
+ - stage: unit
32
+ name: sdk vcr tests
33
+ script: VCR_RECORD_MODE=none bundle exec rake test:sdk
34
+ rvm: jruby-9.1.14
35
+ - stage: unit
36
+ name: sdk vcr tests (project)
37
+ script: VCR_RECORD_MODE=none bundle exec rake test:project
38
+ rvm: jruby-9.1.14
39
+ # integration
40
+ - &lcm-integration-tests
41
+ stage: integration
22
42
  name: lcm integration tests
23
43
  script: |
24
44
  bundle exec rake -f lcm.rake docker:build
@@ -26,11 +46,88 @@ jobs:
26
46
  bundle exec rake -f lcm.rake test:integration:docker
27
47
  rvm:
28
48
  - jruby-9.1.7
29
- - stage: integration
49
+ - &sdk-integration-tests
50
+ stage: integration
30
51
  name: sdk integration tests
31
52
  script: bundle exec rake test:sdk
32
- rvm: jruby-9.1.7
33
- - stage: integration
53
+ rvm: 2.5
54
+ env: VCR_ON=false
55
+ - &sdk-integration-tests-project
56
+ stage: integration
34
57
  name: sdk integration tests (project)
35
58
  script: bundle exec rake test:project
36
- rvm: jruby-9.1.7
59
+ env: VCR_ON=false
60
+ rvm: 2.5
61
+ # periodic
62
+ # staging 1
63
+ - <<: *lcm-integration-tests
64
+ stage: periodic
65
+ name: staging1 - lcm integration tests
66
+ env:
67
+ - GD_ENV=staging
68
+ - VCR_ON=false
69
+ - <<: *sdk-integration-tests
70
+ stage: periodic
71
+ name: staging1 - sdk integration tests
72
+ env:
73
+ - GD_ENV=staging
74
+ - VCR_ON=false
75
+ - <<: *sdk-integration-tests-project
76
+ stage: periodic
77
+ name: staging1 - sdk integration tests (project)
78
+ env:
79
+ - GD_ENV=staging
80
+ - VCR_ON=false
81
+ # staging 2
82
+ - <<: *lcm-integration-tests
83
+ stage: periodic
84
+ name: staging2 - lcm integration tests
85
+ env:
86
+ - GD_ENV=testing
87
+ - VCR_ON=false
88
+ - <<: *sdk-integration-tests
89
+ stage: periodic
90
+ name: staging2 - sdk integration tests
91
+ env:
92
+ - GD_ENV=testing
93
+ - VCR_ON=false
94
+ - <<: *sdk-integration-tests-project
95
+ stage: periodic
96
+ name: staging2 - sdk integration tests (project)
97
+ env:
98
+ - GD_ENV=testing
99
+ - VCR_ON=false
100
+ # staging 3
101
+ - <<: *lcm-integration-tests
102
+ stage: periodic
103
+ name: staging3 - lcm integration tests
104
+ env:
105
+ - GD_ENV=development
106
+ - VCR_ON=false
107
+ - <<: *sdk-integration-tests
108
+ stage: periodic
109
+ name: staging3 - sdk integration tests
110
+ env:
111
+ - GD_ENV=development
112
+ - VCR_ON=false
113
+ - <<: *sdk-integration-tests-project
114
+ stage: periodic
115
+ name: staging3 - sdk integration tests (project)
116
+ env:
117
+ - GD_ENV=development
118
+ - VCR_ON=false
119
+ - &cleanup
120
+ stage: cleanup
121
+ name: staging1 - test environment clean-up
122
+ script: bundle exec ruby bin/test_projects_cleanup.rb -f
123
+ env: GD_ENV=staging
124
+ - <<: *cleanup
125
+ name: staging2 - test environment clean-up
126
+ env: GD_ENV=testing
127
+ - <<: *cleanup
128
+ name: staging3 - test environment clean-up
129
+ env: GD_ENV=development
130
+ notifications:
131
+ slack:
132
+ secure: TyYks8rEBJMouWRjRtHZJJm+BIajxgwsoSIpxidZmD5zRk5ssEkGVbuYIvjUN+if1NyM1bmWspTSVX+8g5IDmt9PgcujXVqCbPRvfK90r3obs8A5pHbDnKEue6inqYUjNoqa1D6PkWTS1dTb6xvy8WiAwMGqoFGHnlNs4WFF9N4=
133
+ on_pull_requests: false
@@ -1,4 +1,45 @@
1
1
  # GoodData Ruby SDK Changelog
2
+ ## 1.3.3
3
+ - Fix git-ignoring project cache
4
+ - Fix style in vcr configurer
5
+ - TMA-1205: Fix vcr configurer setup
6
+ - Describe releasing process more accurately
7
+ - Fix editorconfig
8
+ - TMA-1190: Add cleanup stage to travis.yml
9
+ - gemspec cleanup: transitive deps, email, authors
10
+ - TMA-1190: Add test env clean-up script
11
+ - TMA-1185: Record vcr cassettes
12
+ - TMA-1185: Fix vcr for project cache
13
+ - TMA-1182: UFB extended spec passing
14
+ - TRIVIAL: remove redundant suffix
15
+ - BUGFIX: TMA-1183 don't use make_tmpname
16
+ - TMA-1181: use correct exit code from lcm integ. docker-compose
17
+ - TMA-782: do not rely on spec extensions
18
+ - Revert "TMA-1181: do not use docker for lcm-integration-tests"
19
+ - TMA-1152: logout and delete users after spec
20
+ - FEATURE: TMA-1165 Create Help brick and make it default entry point in Docker image
21
+ - TMA-1181: passing userprov spec
22
+ - TRIVIAL: use the correct ruby version's for tests in travis
23
+ - TMA-1181: do not use docker for lcm-integration-tests
24
+ - Add pry-byebug to dev dependencies
25
+ - Fix standalone calls to rspec expect
26
+ - TMA-782: transfer component type process thru lcm
27
+ - FEATURE: TMA-1165 Remove unused info bricks
28
+ - Enable travis notifications in slack
29
+ - Update gooddata.gemspec
30
+ - TMA-1048 update ads driver dependency
31
+ - Run unit tests in supported rubies
32
+ - Run cron job on staging env 1/2/3
33
+ - FEATURE: TMA-1034 Add Docker label containing LCM bricks version
34
+ - SETI-2444 fix docker run on jenkins slaves
35
+ - TMA-1014: parallel do_not_touch logic in UFB
36
+ - TMA-905: do not print dynamic schedule param value if the param is set as secure
37
+ - BUGFIX: TMA-1153 Adjust LCM brick syslog to be able to log to Splunk
38
+ - TMA-1100 fix productized connector deployment
39
+ - TMA-1071: Record VCR cassettes
40
+ - TMA-1071: Reenable VCR
41
+ - Add pry-byebug to dev dependencies
42
+
2
43
  ## 1.3.2
3
44
  - Add rake task for changelog preview
4
45
  - added possibility to run tests on PI
data/Dockerfile CHANGED
@@ -1,11 +1,14 @@
1
1
  FROM harbor.intgdc.com/tools/gdc-java-8-jre:b057b53
2
2
 
3
3
  ARG GIT_COMMIT=unspecified
4
+ ARG BRICKS_VERSION=unspecified
5
+
4
6
  LABEL image_name="GDC LCM Bricks"
5
7
  LABEL maintainer="LCM <lcm@gooddata.com>"
6
8
  LABEL git_repository_url="https://github.com/gooddata/gooddata-ruby/"
7
9
  LABEL parent_image="harbor.intgdc.com/tools/gdc-java-8-jre:b057b53"
8
10
  LABEL git_commit=$GIT_COMMIT
11
+ LABEL bricks_version=$BRICKS_VERSION
9
12
 
10
13
  # which is required by RVM
11
14
  RUN yum install -y curl which \
@@ -32,4 +35,4 @@ ADD ./gooddata.gemspec .
32
35
 
33
36
  RUN /bin/bash -l -c ". /usr/local/rvm/scripts/rvm && bundle install"
34
37
 
35
- CMD [ "./bin/hello_world.sh" ]
38
+ CMD [ "./bin/help.sh" ]
@@ -2,7 +2,7 @@ FROM ruby:2.3-alpine
2
2
 
3
3
  MAINTAINER Tomas Korcak <korczis@gmail.com>
4
4
 
5
- RUN apk add --no-cache curl make gcc git g++ python linux-headers binutils-gold gnupg libstdc++ openssl cmake
5
+ RUN apk add --no-cache curl make gcc git g++ python linux-headers binutils-gold gnupg libstdc++ openssl cmake curl-dev
6
6
 
7
7
  RUN ln -s /usr/bin/make /usr/bin/gmake
8
8
 
@@ -9,7 +9,10 @@ def config = [
9
9
  'microservices': [
10
10
  'lcm-bricks': [
11
11
  'docker': [
12
- 'dockerfile': './Dockerfile'
12
+ 'dockerfile': './Dockerfile',
13
+ 'arguments': [
14
+ 'BRICKS_VERSION': { readFile('./VERSION').trim() }
15
+ ]
13
16
  ]
14
17
  ]
15
18
  ]
@@ -7,7 +7,7 @@
7
7
  1. `bundle install`
8
8
  1. bump version in [lib/gooddata/version.rb](lib/gooddata/version.rb)
9
9
  1. `bundle exec rake version:bump`
10
- 1. push to master
10
+ 1. create PR to upstream and have it merged
11
11
  1. `git push origin tags/{version}`
12
12
  1. `rake gem:release`
13
13
  1. `rvm use jruby && rm Gemfile.lock && bundle install`
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 3.5.0
@@ -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 help_brick"
@@ -9,7 +9,7 @@ BRICK_PARAM_PREFIX = 'BRICK_PARAM_'
9
9
  brick_type = !ARGV.empty? ? ARGV[0] : DEFAULT_BRICK
10
10
 
11
11
  syslog_node = ENV['NODE_NAME']
12
- log = RemoteSyslogLogger.new(syslog_node, 514, :program => brick_type)
12
+ log = RemoteSyslogLogger.new(syslog_node, 514, :program => "ruby_#{brick_type}", :facility => 'local2')
13
13
 
14
14
  log.info "action=#{brick_type}_execution status=init"
15
15
 
@@ -0,0 +1,97 @@
1
+ example = 'GD_ENV=testing GD_SPEC_PASSWORD=secret bundle exec ruby bin/test_projects_cleanup.rb'
2
+
3
+ if ARGV.include?('-h')
4
+ puts 'Example:'
5
+ puts example
6
+ exit 0
7
+ end
8
+
9
+ require 'gooddata'
10
+ require_relative '../spec/environment/environment'
11
+ GoodData::Environment.load
12
+ config = GoodData::Environment::ConnectionHelper::LCM_ENVIRONMENT
13
+ secrets = GoodData::Environment::ConnectionHelper::SECRETS
14
+
15
+ def delete_project_by_title(title, projects, days = 14, force = false)
16
+ dead_line = Time.now - days * 60 * 60 * 24
17
+ filtered_projects = projects.select do |p|
18
+ p.title.match(title) && p.created < dead_line
19
+ end
20
+ filtered_projects.each do |project|
21
+ if force
22
+ puts "Deleting: #{project.pid} - #{project.title} - #{project.created}"
23
+ project_add = project.add
24
+ project_add && project_add.output_stage && project_add.output_stage.delete
25
+ project.delete
26
+ else
27
+ puts "Would delete: #{project.pid} - #{project.title} - #{project.created}"
28
+ end
29
+ end
30
+ puts "#{filtered_projects.length} projects matching \"#{title}\" #{'would be ' unless force}deleted."
31
+ end
32
+
33
+ def delete_ads_by_title(title, client, days = 14, force = false)
34
+ warehouses = client.warehouses
35
+ return if warehouses.empty?
36
+
37
+ deleted = 0
38
+ warehouses.each do |warehouse|
39
+ warehouse_title = warehouse.title
40
+ next unless warehouse_title.match(title)
41
+
42
+ dead_line = Time.now - days * 60 * 60 * 24
43
+ created = Time.parse(warehouse.data["created"])
44
+ next if created > dead_line
45
+
46
+ begin
47
+ if force
48
+ puts "Deleting: #{warehouse_title} - #{created}"
49
+ warehouse.delete
50
+ else
51
+ puts "Would delete: #{warehouse_title} - #{created}"
52
+ end
53
+ deleted += 1
54
+ rescue StandardError => e
55
+ puts "Failed to delete #{warehouse_title}: #{e}"
56
+ end
57
+ end
58
+ puts "#{deleted} ADS instances with title \"#{title}\" #{'would be ' unless force}deleted."
59
+ end
60
+
61
+ def clean_up!(client, force, days)
62
+ projects = client.projects
63
+ delete_project_by_title(/Insurance Demo Master/, projects, days, force)
64
+ delete_project_by_title(/Car Demo Master/, projects, days, force)
65
+ delete_project_by_title(/Insurance Demo Workspace/, projects, days, force)
66
+ delete_project_by_title(/Client With Conflicting LDM/, projects, days, force)
67
+ delete_project_by_title(/Development Project/, projects, days, force)
68
+ delete_project_by_title(/lcm-test-fixture/, projects, days, force)
69
+ delete_project_by_title(/Test MASTER project/, projects, days, force)
70
+ delete_project_by_title(/Test MINOR project/, projects, days, force)
71
+ delete_project_by_title(/^Test project$/, projects, days, force)
72
+ delete_project_by_title(/userprov-e2e-testing/, projects, days, force)
73
+ delete_ads_by_title(/Development ADS/, client, days, force)
74
+ delete_ads_by_title(/Production ADS/, client, days, force)
75
+ end
76
+
77
+ def init_client(username, password, server)
78
+ GoodData.connect(
79
+ username,
80
+ password,
81
+ server: server,
82
+ verify_ssl: false,
83
+ timeout: nil
84
+ )
85
+ end
86
+
87
+ username = config[:username]
88
+ password = secrets[:password]
89
+ dev_client = init_client(username, password, "https://#{config[:dev_server]}")
90
+ prod_client = init_client(username, password, "https://#{config[:prod_server]}")
91
+
92
+ force = ARGV.include?('-f')
93
+ days = 14
94
+ clean_up!(dev_client, force, days)
95
+ clean_up!(prod_client, force, days)
96
+
97
+ dev_client.disconnect
@@ -13,12 +13,15 @@ Gem::Specification.new do |s|
13
13
  'Pavel Kolesnikov',
14
14
  'Thomas Watson Steen',
15
15
  'Tomas Svarovsky',
16
- 'Tomas Korcak'
16
+ 'Tomas Korcak',
17
+ 'Jan Zdrahal',
18
+ 'Petr Gadorek',
19
+ 'Jakub Mahnert'
17
20
  ]
18
21
 
19
22
  s.summary = 'A convenient Ruby wrapper around the GoodData RESTful API'
20
23
  s.description = 'Use the GoodData::Client class to integrate GoodData into your own application or use the CLI to work with GoodData directly from the command line.'
21
- s.email = 'pavel@gooddata.com'
24
+ s.email = 'lcm@gooddata.com'
22
25
  s.extra_rdoc_files = %w(LICENSE README.md)
23
26
 
24
27
  s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
@@ -42,6 +45,8 @@ Gem::Specification.new do |s|
42
45
  s.add_development_dependency 'yard-rspec', '~> 0.1'
43
46
  s.add_development_dependency 'ZenTest', '~> 4.11'
44
47
  s.add_development_dependency 'pry'
48
+ s.add_development_dependency 'pry-byebug', '~> 3.6' if RUBY_PLATFORM != 'java'
49
+
45
50
  s.add_development_dependency 'pronto', '~> 0.9.5' if RUBY_PLATFORM != 'java'
46
51
  s.add_development_dependency 'pronto-rubocop', '~> 0.9.0' if RUBY_PLATFORM != 'java'
47
52
  s.add_development_dependency 'pronto-reek', '~> 0.9.0' if RUBY_PLATFORM != 'java'
@@ -53,8 +58,7 @@ Gem::Specification.new do |s|
53
58
  s.add_dependency 'docile', '~> 1.1'
54
59
  s.add_dependency 'erubis', '~> 2.7'
55
60
  s.add_dependency 'gli', '~> 2.15'
56
- s.add_dependency 'gooddata_datawarehouse' if RUBY_PLATFORM == 'java'
57
- s.add_dependency 'gooddata-dss-jdbc', '0.1.12' if RUBY_PLATFORM == 'java'
61
+ s.add_dependency 'gooddata_datawarehouse', '~> 0.0.9' if RUBY_PLATFORM == 'java'
58
62
  s.add_dependency 'highline', '= 2.0.0.pre.develop.14'
59
63
  s.add_dependency 'json_pure', '~> 1.8'
60
64
  s.add_dependency 'multi_json', '~> 1.12'
data/lcm.rake CHANGED
@@ -92,12 +92,8 @@ namespace :test do
92
92
  namespace :integration do
93
93
  desc 'Run integration tests in Docker'
94
94
  task :docker do
95
- system('docker-compose -f docker-compose.lcm.yml up --force-recreate --abort-on-container-exit appstore')
96
-
97
- # TODO: use exit-code-from after update to docker-compose >= 1.12
98
- # system('docker-compose up --exit-code-from appstore') ||
99
- # fail('Test execution failed')
100
- system(check_exit_code) || fail('Test execution failed!')
95
+ system('docker-compose -f docker-compose.lcm.yml up --force-recreate --abort-on-container-exit --exit-code-from appstore appstore') ||
96
+ fail('Test execution failed!')
101
97
  end
102
98
  end
103
99
  namespace :load do
@@ -14,7 +14,7 @@ module GoodData
14
14
  # @option [String] 'message' text to be returned in result, if nill - nothing is returned
15
15
  # :reek:UtilityFunction
16
16
  def call(params)
17
- GoodData::LCM2.perform('hello_world', params)
17
+ GoodData::LCM2.perform('hello', params)
18
18
  end
19
19
  end
20
20
  end
@@ -0,0 +1,17 @@
1
+ require_relative 'brick'
2
+
3
+ module GoodData
4
+ module Bricks
5
+ # Simple brick used for printing help message about bricks
6
+ class HelpBrick < GoodData::Bricks::Brick
7
+ def version
8
+ '0.0.1'
9
+ end
10
+
11
+ # Help brick entry-point
12
+ def call(params)
13
+ GoodData::LCM2.perform('help', params)
14
+ end
15
+ end
16
+ end
17
+ end
@@ -99,6 +99,17 @@ module GoodData
99
99
  ]
100
100
  )
101
101
  end
102
+
103
+ def self.help_brick_pipeline
104
+ prepare(
105
+ [
106
+ DecodeParamsMiddleware,
107
+ LoggerMiddleware,
108
+ BenchMiddleware,
109
+ HelpBrick
110
+ ]
111
+ )
112
+ end
102
113
  end
103
114
  end
104
115
  end
@@ -231,7 +231,10 @@ module GoodData
231
231
  end
232
232
 
233
233
  def decrypt(database64, key)
234
- return '' if key.nil? || key.empty?
234
+ if key.nil? || key.empty?
235
+ puts 'WARNING: No encryption key provided.'
236
+ return 'no_key_provided'
237
+ end
235
238
 
236
239
  data = Base64.decode64(database64)
237
240
 
@@ -26,6 +26,9 @@ module GoodData
26
26
 
27
27
  description 'Value Column'
28
28
  param :param_value_column, instance_of(Type::StringType), required: false
29
+
30
+ description 'Should the param be hidden?'
31
+ param :param_secure_column, instance_of(Type::StringType), required: false
29
32
  end
30
33
 
31
34
  class << self
@@ -36,6 +39,7 @@ module GoodData
36
39
  client_id_column = params.client_id_column || 'client_id'
37
40
  param_name_column = params.param_name_column || 'param_name'
38
41
  param_value_column = params.param_value_column || 'param_value'
42
+ param_secure_column = params.param_secure_column || 'param_secure'
39
43
  results = []
40
44
 
41
45
  input_source = params.dynamic_params.input_source
@@ -43,16 +47,18 @@ module GoodData
43
47
  input_data = without_check(PARAMS, params) do
44
48
  File.open(data_source.realize(params), 'r:UTF-8')
45
49
  end
46
- GoodData.logger.debug("Input data: #{input_data.read}")
47
50
 
48
51
  schedule_params = {}
49
52
 
50
53
  CSV.foreach(input_data, :headers => true, :return_headers => false, encoding: 'utf-8') do |row|
51
- GoodData.logger.debug("Processing row: #{row}")
52
- results << row.to_hash
53
-
54
- client_id = row[client_id_column] ? row[client_id_column] : :all_clients
55
- schedule_name = row[schedule_title_column] ? row[schedule_title_column] : :all_schedules
54
+ is_param_secure = row[param_secure_column] == 'true'
55
+ safe_to_print_row = row.to_hash
56
+ safe_to_print_row[param_value_column] = '******' if is_param_secure
57
+ GoodData.logger.debug("Processing row: #{safe_to_print_row}")
58
+ results << safe_to_print_row
59
+
60
+ client_id = row[client_id_column] || :all_clients
61
+ schedule_name = row[schedule_title_column] || :all_schedules
56
62
 
57
63
  schedule_params[client_id] ||= {}
58
64
  schedule_params[client_id][schedule_name] ||= {}
@@ -0,0 +1,33 @@
1
+ # Copyright (c) 2010-2018 GoodData Corporation. All rights reserved.
2
+ # This source code is licensed under the BSD-style license found in the
3
+ # LICENSE file in the root directory of this source tree.
4
+
5
+ require 'gooddata/bricks/pipeline'
6
+
7
+ require_relative 'base_action'
8
+
9
+ module GoodData
10
+ module LCM2
11
+ # Action responsible for printing bricks help
12
+ class Help < BaseAction
13
+ DESCRIPTION = 'Print Help Message'
14
+
15
+ PARAMS = {}
16
+
17
+ class << self
18
+ BRICK_PIPELINE_SUFFIX = /_brick_pipeline$/
19
+
20
+ def create_help
21
+ GoodData::Bricks::Pipeline.methods
22
+ .grep(BRICK_PIPELINE_SUFFIX)
23
+ .map { |method| method.to_s.sub(BRICK_PIPELINE_SUFFIX, '') }
24
+ .map { |available_brick| { available_brick: available_brick } }
25
+ end
26
+
27
+ def call(_params)
28
+ { results: create_help }
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -19,10 +19,16 @@ module GoodData
19
19
  param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
20
20
 
21
21
  description 'Schedule Additional Parameters'
22
- param :additional_params, instance_of(Type::HashType), required: false
22
+ param :additional_params, instance_of(Type::HashType), required: false, deprecated: true, replacement: :schedule_additional_params
23
23
 
24
24
  description 'Schedule Additional Secure Parameters'
25
- param :additional_hidden_params, instance_of(Type::HashType), required: false
25
+ param :additional_hidden_params, instance_of(Type::HashType), required: false, deprecated: true, replacement: :schedule_additional_hidden_params
26
+
27
+ description 'Schedule Additional Parameters'
28
+ param :schedule_additional_params, instance_of(Type::HashType), required: false
29
+
30
+ description 'Schedule Additional Secure Parameters'
31
+ param :schedule_additional_hidden_params, instance_of(Type::HashType), required: false
26
32
 
27
33
  description 'Schedule Parameters'
28
34
  param :schedule_params, instance_of(Type::HashType), required: false, default: {}
@@ -50,6 +56,10 @@ module GoodData
50
56
  def call(params)
51
57
  client = params.gdc_gd_client
52
58
  data_product = params.data_product
59
+
60
+ schedule_additional_params = params.schedule_additional_params || params.additional_params
61
+ schedule_additional_hidden_params = params.schedule_additional_hidden_params || params.additional_hidden_params
62
+
53
63
  synchronize_segments = params.synchronize.group_by do |info|
54
64
  info[:segment_id]
55
65
  end
@@ -125,14 +135,14 @@ module GoodData
125
135
  end
126
136
  end
127
137
 
128
- schedule.update_params(params.additional_params) if params.additional_params
138
+ schedule.update_params(schedule_additional_params) if schedule_additional_params
129
139
 
130
140
  schedule.update_params(params_for_all_schedules_in_all_projects) if params_for_all_schedules_in_all_projects
131
141
  schedule.update_params(params_for_all_projects[schedule.name]) if params_for_all_projects[schedule.name]
132
142
  schedule.update_params(params_for_all_schedules_in_this_client) if params_for_all_schedules_in_this_client
133
143
  schedule.update_params(params_for_this_client[schedule.name]) if params_for_this_client[schedule.name]
134
144
 
135
- schedule.update_hidden_params(params.additional_hidden_params) if params.additional_hidden_params
145
+ schedule.update_hidden_params(schedule_additional_hidden_params) if schedule_additional_hidden_params
136
146
  schedule.enable
137
147
  schedule.save
138
148
  end
@@ -24,8 +24,8 @@ module GoodData
24
24
  description 'Logger'
25
25
  param :gdc_logger, instance_of(Type::GdLogger), required: true
26
26
 
27
- description 'Additional Hidden Parameters'
28
- param :additional_hidden_params, instance_of(Type::HashType), required: false
27
+ description 'Additional Hidden Parameters of Processes'
28
+ param :process_additional_hidden_params, instance_of(Type::HashType), required: false
29
29
  end
30
30
 
31
31
  RESULT_HEADER = [
@@ -59,7 +59,8 @@ module GoodData
59
59
  from,
60
60
  to_project,
61
61
  ads_output_stage_uri: info.ads_output_stage_uri,
62
- ads_output_stage_prefix: info.ads_output_stage_prefix
62
+ ads_output_stage_prefix: info.ads_output_stage_prefix,
63
+ additional_hidden_params: params.process_additional_hidden_params
63
64
  )
64
65
 
65
66
  to_project.add.output_stage.client_id = client_id if client_id && to_project.add.output_stage
@@ -22,10 +22,16 @@ module GoodData
22
22
  param :synchronize, array_of(instance_of(Type::SynchronizationInfoType)), required: true, generated: true
23
23
 
24
24
  description 'Schedule Additional Parameters'
25
- param :additional_params, instance_of(Type::HashType), required: false
25
+ param :additional_params, instance_of(Type::HashType), required: false, deprecated: true, replacement: :schedule_additional_params
26
26
 
27
27
  description 'Schedule Additional Secure Parameters'
28
- param :additional_hidden_params, instance_of(Type::HashType), required: false
28
+ param :additional_hidden_params, instance_of(Type::HashType), required: false, deprecated: true, replacement: :schedule_additional_hidden_params
29
+
30
+ description 'Schedule Additional Parameters'
31
+ param :schedule_additional_params, instance_of(Type::HashType), required: false
32
+
33
+ description 'Schedule Additional Secure Parameters'
34
+ param :schedule_additional_hidden_params, instance_of(Type::HashType), required: false
29
35
 
30
36
  description 'Logger'
31
37
  param :gdc_logger, instance_of(Type::GdLogger), required: true
@@ -47,6 +53,9 @@ module GoodData
47
53
  client = params.gdc_gd_client
48
54
  development_client = params.development_client
49
55
 
56
+ schedule_additional_params = params.schedule_additional_params || params.additional_params
57
+ schedule_additional_hidden_params = params.schedule_additional_hidden_params || params.additional_hidden_params
58
+
50
59
  params.synchronize.peach do |info|
51
60
  from_project = info.from
52
61
  to_projects = info.to
@@ -68,8 +77,8 @@ module GoodData
68
77
  # s.update_params('GOODOT_CUSTOM_PROJECT_ID' => c.id)
69
78
  # s.update_params('CLIENT_ID' => c.id)
70
79
  # s.update_params('SEGMENT_ID' => segment.id)
71
- schedule.update_params(params.additional_params || {})
72
- schedule.update_hidden_params(params.additional_hidden_params || {})
80
+ schedule.update_params(schedule_additional_params || {})
81
+ schedule.update_hidden_params(schedule_additional_hidden_params || {})
73
82
  schedule.disable
74
83
  schedule.save
75
84
 
@@ -90,13 +90,16 @@ module GoodData
90
90
  client = params.gdc_gd_client
91
91
  domain_name = params.organization || params.domain
92
92
  fail "Either organisation or domain has to be specified in params" unless domain_name
93
+
93
94
  domain = client.domain(domain_name) if domain_name
94
95
  project = client.projects(params.gdc_project) || client.projects(params.gdc_project_id)
95
96
  fail "Either project or project_id has to be specified in params" unless project
97
+
96
98
  data_product = params.data_product
97
99
 
98
100
  config = params.filters_config
99
101
  fail 'User filters brick requires configuration how the filter should be setup. For this use the param "filters_config"' if config.blank?
102
+
100
103
  symbolized_config = GoodData::Helpers.deep_dup(config)
101
104
  symbolized_config = GoodData::Helpers.symbolize_keys(symbolized_config)
102
105
  symbolized_config[:labels] = symbolized_config[:labels].map { |l| GoodData::Helpers.symbolize_keys(l) }
@@ -133,6 +136,7 @@ module GoodData
133
136
  user_filters.group_by { |u| u[:pid] }.flat_map.pmap do |id, new_filters|
134
137
  users = users_by_project[id]
135
138
  fail "The #{multiple_projects_column} cannot be empty" if id.blank?
139
+
136
140
  if mode == 'sync_multiple_projects_based_on_custom_id'
137
141
  current_project = domain.clients(id, data_product).project
138
142
  elsif mode == 'sync_multiple_projects_based_on_pid'
@@ -154,40 +158,34 @@ module GoodData
154
158
  user_filters.group_by { |u| u[multiple_projects_column] }.flat_map.pmap do |client_id, new_filters|
155
159
  users = users_by_project[client_id]
156
160
  fail "Client id cannot be empty" if client_id.blank?
161
+
157
162
  c = domain.clients(client_id, data_product)
158
163
  if params.segments && !segment_uris.include?(c.segment_uri)
159
- puts "Client #{client_id} is outside segments_filter #{params.segments}"
164
+ params.gdc_logger.warn "Client #{client_id} is outside segments_filter #{params.segments}"
160
165
  next
161
166
  end
162
167
  current_project = c.project
163
168
  fail "Client #{client_id} does not have project." unless current_project
169
+
164
170
  working_client_ids << client_id
165
171
  partial_results = sync_user_filters(current_project, new_filters, run_params.merge(users_brick_input: users), symbolized_config)
166
172
  results.concat(partial_results[:results])
167
173
  end
168
174
 
169
175
  unless run_params[:do_not_touch_filters_that_are_not_mentioned]
170
- domain_clients.each do |c|
176
+ domain_clients.peach do |c|
171
177
  next if working_client_ids.include?(c.client_id)
178
+
172
179
  begin
173
180
  current_project = c.project
174
- rescue => e
175
- puts "Error when accessing project of client #{c.client_id}. Error: #{e}"
176
- next
177
- end
178
- unless current_project
179
- puts "Client #{c.client_id} has no project."
180
- next
181
- end
182
- if current_project.deleted?
183
- puts "Project #{current_project.pid} of client #{c.client_id} is deleted."
184
- next
185
- end
181
+ users = users_by_project[c.client_id]
182
+ params.gdc_logger.info "Delete all filters in project #{current_project.pid} of client #{c.client_id}"
183
+ current_results = sync_user_filters(current_project, [], run_params.merge(users_brick_input: users), symbolized_config)
186
184
 
187
- puts "Delete all filters in project #{current_project.pid} of client #{c.client_id}"
188
- users = users_by_project[c.client_id]
189
- delete_results = current_project.add_data_permissions([], run_params.merge(users_brick_input: users))
190
- results.concat(delete_results[:results])
185
+ results.concat(current_results[:results])
186
+ rescue StandardError => e
187
+ params.gdc_logger.error "Failed to clear filters of #{c.client_id} due to: #{e.inspect}"
188
+ end
191
189
  end
192
190
  end
193
191
 
@@ -75,32 +75,15 @@ module GoodData
75
75
  end
76
76
 
77
77
  MODES = {
78
- # Low Level Commands
79
-
80
- actions: [
81
- PrintActions
82
- ],
83
78
 
84
79
  hello: [
85
80
  HelloWorld
86
81
  ],
87
82
 
88
- modes: [
89
- PrintModes
90
- ],
91
-
92
- info: [
93
- PrintTypes,
94
- PrintActions,
95
- PrintModes
96
- ],
97
-
98
- types: [
99
- PrintTypes
83
+ help: [
84
+ Help
100
85
  ],
101
86
 
102
- ## Bricks
103
-
104
87
  release: [
105
88
  EnsureReleaseTable,
106
89
  CollectDataProduct,
@@ -170,11 +153,8 @@ module GoodData
170
153
 
171
154
  schedules_execution: [
172
155
  ExecuteSchedules
173
- ],
174
-
175
- hello_world: [
176
- HelloWorld
177
156
  ]
157
+
178
158
  }
179
159
 
180
160
  MODE_NAMES = MODES.keys
@@ -365,7 +365,10 @@ Available values for setting language are: #{available_languages}."
365
365
  # use fuzzy_get_user.
366
366
  #
367
367
  # @param [String] name Name to look for
368
- # @param [Array<GoodData::User>]user_list Optional cached list of users used for look-ups
368
+ # @param [Array<GoodData::User>] user_list
369
+ # Optional cached list of users used for look-ups.
370
+ # WARNING: If not specified, in the worst case the
371
+ # method gets all users from the domain!
369
372
  # @return [GoodDta::Membership] User
370
373
  def get_user(name, user_list = users)
371
374
  return member(name, user_list) if name.instance_of?(GoodData::Membership)
@@ -187,8 +187,8 @@ module GoodData
187
187
  def deploy_component(data, options = { client: GoodData.client, project: GoodData.project })
188
188
  client, project = GoodData.get_client_and_project(options)
189
189
  data = { process: data } unless data[:process]
190
- data[:process] = GoodData::Helpers.symbolize_keys(data[:process]).select { |k| [:type, :name, :component].include? k }
191
- data[:process][:component] = GoodData::Helpers.symbolize_keys(data[:process][:component]).select { |k| [:name, :version].include? k }
190
+ data[:process] = GoodData::Helpers.symbolize_keys(data[:process]).select { |k| %i[type name component].include? k }
191
+ data[:process][:component] = GoodData::Helpers.symbolize_keys(data[:process][:component]).select { |k| %i[name version configLocation].include? k }
192
192
 
193
193
  # a feature flag is required to create component type processes
194
194
  client.post "/gdc/projects/#{project.pid}/projectFeatureFlags",
@@ -262,6 +262,7 @@ module GoodData
262
262
  def transfer_processes(from_project, to_project, options = {})
263
263
  options = GoodData::Helpers.symbolize_keys(options)
264
264
  to_project_processes = to_project.processes
265
+ additional_hidden_params = options[:additional_hidden_params] || {}
265
266
  result = from_project.processes.uniq(&:name).map do |process|
266
267
  fail "The process name #{process.name} must be unique in transfered project #{to_project}" if to_project_processes.count { |p| p.name == process.name } > 1
267
268
  next if process.type == :dataload
@@ -272,7 +273,8 @@ module GoodData
272
273
  GoodData::Process.deploy_from_appstore(process.path, name: process.name, client: to_project.client, project: to_project)
273
274
  elsif process.component
274
275
  to_process.delete if to_process
275
- GoodData::Process.deploy_component(GoodData::Helpers.symbolize_keys(process.to_hash), project: to_project, client: to_project.client)
276
+ process_hash = GoodData::Helpers::DeepMergeableHash[GoodData::Helpers.symbolize_keys(process.to_hash)].deep_merge(additional_hidden_params)
277
+ GoodData::Process.deploy_component(process_hash, project: to_project, client: to_project.client)
276
278
  else
277
279
  Dir.mktmpdir('etl_transfer') do |dir|
278
280
  dir = Pathname(dir)
@@ -6,7 +6,7 @@
6
6
 
7
7
  # GoodData Module
8
8
  module GoodData
9
- VERSION = '1.3.2'
9
+ VERSION = '1.3.3'
10
10
 
11
11
  class << self
12
12
  # Version
metadata CHANGED
@@ -1,17 +1,20 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gooddata
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Kolesnikov
8
8
  - Thomas Watson Steen
9
9
  - Tomas Svarovsky
10
10
  - Tomas Korcak
11
+ - Jan Zdrahal
12
+ - Petr Gadorek
13
+ - Jakub Mahnert
11
14
  autorequire:
12
15
  bindir: bin
13
16
  cert_chain: []
14
- date: 2018-10-05 00:00:00.000000000 Z
17
+ date: 2018-11-23 00:00:00.000000000 Z
15
18
  dependencies:
16
19
  - !ruby/object:Gem::Dependency
17
20
  name: bundler
@@ -209,6 +212,20 @@ dependencies:
209
212
  - - ">="
210
213
  - !ruby/object:Gem::Version
211
214
  version: '0'
215
+ - !ruby/object:Gem::Dependency
216
+ name: pry-byebug
217
+ requirement: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - "~>"
220
+ - !ruby/object:Gem::Version
221
+ version: '3.6'
222
+ type: :development
223
+ prerelease: false
224
+ version_requirements: !ruby/object:Gem::Requirement
225
+ requirements:
226
+ - - "~>"
227
+ - !ruby/object:Gem::Version
228
+ version: '3.6'
212
229
  - !ruby/object:Gem::Dependency
213
230
  name: pronto
214
231
  requirement: !ruby/object:Gem::Requirement
@@ -539,15 +556,17 @@ dependencies:
539
556
  version: '0'
540
557
  description: Use the GoodData::Client class to integrate GoodData into your own application
541
558
  or use the CLI to work with GoodData directly from the command line.
542
- email: pavel@gooddata.com
559
+ email: lcm@gooddata.com
543
560
  executables:
544
561
  - gitflow-init.sh
545
562
  - gooddata
546
563
  - hello_world.sh
564
+ - help.sh
547
565
  - provisioning.sh
548
566
  - release.sh
549
567
  - rollout.sh
550
568
  - run_brick.rb
569
+ - test_projects_cleanup.rb
551
570
  - user_filters.sh
552
571
  - users.sh
553
572
  extensions: []
@@ -581,14 +600,17 @@ files:
581
600
  - RELEASING.md
582
601
  - Rakefile
583
602
  - TODO.md
603
+ - VERSION
584
604
  - authors.sh
585
605
  - bin/gitflow-init.sh
586
606
  - bin/gooddata
587
607
  - bin/hello_world.sh
608
+ - bin/help.sh
588
609
  - bin/provisioning.sh
589
610
  - bin/release.sh
590
611
  - bin/rollout.sh
591
612
  - bin/run_brick.rb
613
+ - bin/test_projects_cleanup.rb
592
614
  - bin/user_filters.sh
593
615
  - bin/users.sh
594
616
  - ci.rake
@@ -608,6 +630,7 @@ files:
608
630
  - lib/gooddata/bricks/brick.rb
609
631
  - lib/gooddata/bricks/bricks.rb
610
632
  - lib/gooddata/bricks/hello_world_brick.rb
633
+ - lib/gooddata/bricks/help_brick.rb
611
634
  - lib/gooddata/bricks/middleware/aws_middleware.rb
612
635
  - lib/gooddata/bricks/middleware/base_middleware.rb
613
636
  - lib/gooddata/bricks/middleware/bench_middleware.rb
@@ -719,10 +742,8 @@ files:
719
742
  - lib/gooddata/lcm/actions/ensure_technical_users_project.rb
720
743
  - lib/gooddata/lcm/actions/execute_schedules.rb
721
744
  - lib/gooddata/lcm/actions/hello_world.rb
745
+ - lib/gooddata/lcm/actions/help.rb
722
746
  - lib/gooddata/lcm/actions/import_object_collections.rb
723
- - lib/gooddata/lcm/actions/print_actions.rb
724
- - lib/gooddata/lcm/actions/print_modes.rb
725
- - lib/gooddata/lcm/actions/print_types.rb
726
747
  - lib/gooddata/lcm/actions/provision_clients.rb
727
748
  - lib/gooddata/lcm/actions/purge_clients.rb
728
749
  - lib/gooddata/lcm/actions/rename_existing_client_projects.rb
@@ -950,7 +971,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
950
971
  version: '0'
951
972
  requirements: []
952
973
  rubyforge_project:
953
- rubygems_version: 2.6.11
974
+ rubygems_version: 2.7.4
954
975
  signing_key:
955
976
  specification_version: 4
956
977
  summary: A convenient Ruby wrapper around the GoodData RESTful API
@@ -1,58 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2017 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_relative 'base_action'
8
-
9
- module GoodData
10
- module LCM2
11
- class PrintActions < BaseAction
12
- DESCRIPTION = 'Print Information About Actions'
13
-
14
- PARAMS = {
15
- }
16
-
17
- class << self
18
- def call(params)
19
- results = []
20
-
21
- actions = GoodData::LCM2::BaseAction.descendants
22
-
23
- actions.each do |action|
24
- action_params = action.const_get(:PARAMS)
25
- action_params_keys = action_params.keys
26
- params = action_params_keys.map do |param|
27
- param
28
- end
29
-
30
- types = action_params.map do |_k, param|
31
- param[:type].class.short_name
32
- end
33
-
34
- required = action_params.map do |_k, param|
35
- param[:opts][:required]
36
- end
37
-
38
- defaults = action_params.map do |_k, param|
39
- param[:opts][:default]
40
- end
41
-
42
- results << {
43
- name: action.short_name,
44
- description: action.const_get(:DESCRIPTION),
45
- params: params.join("\n"),
46
- types: types.join("\n"),
47
- required: required.join("\n"),
48
- default: defaults.join("\n")
49
- }
50
- end
51
-
52
- # Return results
53
- results
54
- end
55
- end
56
- end
57
- end
58
- end
@@ -1,69 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2017 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_relative 'base_action'
8
-
9
- module GoodData
10
- module LCM2
11
- class PrintModes < BaseAction
12
- DESCRIPTION = 'Print Modes'
13
-
14
- PARAMS = {
15
- }
16
-
17
- class << self
18
- def call(params)
19
- results = []
20
- GoodData::LCM2::MODES.keys.each_with_index do |mode, index|
21
- actions = GoodData::LCM2::MODES[mode]
22
- action_names = actions.map do |k, _action|
23
- params_length = k.const_get(:PARAMS).keys.length
24
- k.short_name + ("\n" * (params_length > 1 ? params_length - 1 : 0))
25
- end
26
-
27
- params = actions.map do |action|
28
- action.const_get(:PARAMS).map do |_k, param|
29
- param[:name]
30
- end
31
- end
32
-
33
- types = actions.map do |action|
34
- action.const_get(:PARAMS).map do |_k, param|
35
- param[:type]
36
- # param[:type].class.short_name
37
- end
38
- end
39
-
40
- required = actions.map do |action|
41
- action.const_get(:PARAMS).map do |_k, param|
42
- param[:opts][:required]
43
- end
44
- end
45
-
46
- defaults = actions.map do |action|
47
- action.const_get(:PARAMS).map do |_k, param|
48
- param[:opts][:default]
49
- end
50
- end
51
-
52
- results << {
53
- '#' => index,
54
- mode: mode,
55
- actions: action_names.join("\n"),
56
- params: params.join("\n"),
57
- types: types.join("\n"),
58
- required: required.join("\n"),
59
- default: defaults.join("\n")
60
- }
61
- end
62
-
63
- # Return results
64
- results
65
- end
66
- end
67
- end
68
- end
69
- end
@@ -1,52 +0,0 @@
1
- # encoding: UTF-8
2
- #
3
- # Copyright (c) 2010-2017 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_relative 'base_action'
8
-
9
- module GoodData
10
- module LCM2
11
- class PrintTypes < BaseAction
12
- DESCRIPTION = 'Print Information About Defined Types'
13
-
14
- PARAMS = {
15
- }
16
-
17
- class << self
18
- def call(_params)
19
- results = []
20
-
21
- GoodData::LCM2::Dsl::Dsl::TYPES.each_pair do |k, v|
22
- vals = []
23
- v.each_pair do |_name, val|
24
- vals << val[:type]
25
- end
26
-
27
- required = []
28
- v.each_pair do |_name, val|
29
- required << val[:opts][:required]
30
- end
31
-
32
- defaults = []
33
- v.each_pair do |_name, val|
34
- defaults << val[:opts][:default]
35
- end
36
-
37
- results << {
38
- class: k.short_name,
39
- param: v.keys.join("\n"),
40
- type: vals.join("\n"),
41
- required: required.join("\n"),
42
- default: defaults.join("\n")
43
- }
44
- end
45
-
46
- # Return results
47
- results
48
- end
49
- end
50
- end
51
- end
52
- end