foreman_rh_cloud 14.4.0 → 14.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/controllers/api/v2/rh_cloud/cloud_request_controller.rb +1 -0
- data/app/controllers/api/v2/rh_cloud/inventory_controller.rb +11 -5
- data/app/controllers/foreman_inventory_upload/accounts_controller.rb +0 -1
- data/app/controllers/foreman_inventory_upload/uploads_controller.rb +0 -11
- data/app/controllers/foreman_inventory_upload/uploads_settings_controller.rb +0 -8
- data/app/services/foreman_rh_cloud/cert_auth.rb +2 -1
- data/app/services/foreman_rh_cloud/cloud_presence.rb +23 -0
- data/app/services/foreman_rh_cloud/cloud_request.rb +2 -1
- data/app/services/foreman_rh_cloud/cloud_request_forwarder.rb +9 -5
- data/config/routes.rb +1 -3
- data/lib/foreman_rh_cloud/engine.rb +1 -6
- data/lib/foreman_rh_cloud/plugin.rb +4 -2
- data/lib/foreman_rh_cloud/version.rb +1 -1
- data/lib/foreman_rh_cloud.rb +16 -0
- data/lib/insights_cloud/async/cloud_connector_announce_task.rb +76 -19
- data/package.json +1 -1
- data/test/controllers/inventory_upload/api/inventory_controller_test.rb +10 -8
- data/test/jobs/cloud_connector_announce_task_test.rb +116 -106
- data/test/unit/foreman_rh_cloud_iop_metadata_test.rb +27 -0
- data/test/unit/services/foreman_rh_cloud/cloud_request_forwarder_test.rb +28 -0
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/__tests__/integrations.test.js +4 -12
- data/webpack/ForemanInventoryUpload/Components/PageHeader/components/SyncButton/components/__tests__/Toast.test.js +62 -61
- data/webpack/InsightsCloudSync/Components/InsightsTable/__tests__/InsightsTableActions.test.js +2 -2
- data/webpack/InsightsCloudSync/__tests__/InsightsCloudSyncActions.test.js +7 -5
- data/webpack/InsightsHostDetailsTab/__tests__/InsightsTabIntegration.test.js +69 -8
- data/webpack/InsightsVulnerabilityActionsBar/__tests__/InsightsVulnerabilityActionsBar.test.js +1 -5
- data/webpack/test_setup.js +1 -0
- metadata +2 -8
- data/app/services/foreman_rh_cloud/cloud_connector.rb +0 -74
- data/webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js +0 -6
- data/webpack/__mocks__/foremanReact/common/I18n.js +0 -6
- data/webpack/__mocks__/foremanReact/common/helpers.js +0 -14
- data/webpack/__mocks__/foremanReact/constants.js +0 -24
- data/webpack/__mocks__/foremanReact/redux/API/APISelectors.js +0 -24
- data/webpack/__mocks__/foremanReact/redux/API/index.js +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import 'foremanJSTestSetup';
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: foreman_rh_cloud
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 14.
|
|
4
|
+
version: 14.6.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Foreman Red Hat Cloud team
|
|
@@ -107,7 +107,6 @@ files:
|
|
|
107
107
|
- app/overrides/layouts/base/styles.html.erb.deface
|
|
108
108
|
- app/services/foreman_rh_cloud/branch_info.rb
|
|
109
109
|
- app/services/foreman_rh_cloud/cert_auth.rb
|
|
110
|
-
- app/services/foreman_rh_cloud/cloud_connector.rb
|
|
111
110
|
- app/services/foreman_rh_cloud/cloud_ping_service.rb
|
|
112
111
|
- app/services/foreman_rh_cloud/cloud_presence.rb
|
|
113
112
|
- app/services/foreman_rh_cloud/cloud_request.rb
|
|
@@ -478,20 +477,14 @@ files:
|
|
|
478
477
|
- webpack/InsightsVulnerabilityHostIndexExtensions/__tests__/CVECountCell.test.js
|
|
479
478
|
- webpack/IopPathwayDetails/IopPathwayDetails.js
|
|
480
479
|
- webpack/IopRecommendationDetails/IopRecommendationDetails.js
|
|
481
|
-
- webpack/__mocks__/foremanReact/Root/Context/ForemanContext.js
|
|
482
|
-
- webpack/__mocks__/foremanReact/common/I18n.js
|
|
483
480
|
- webpack/__mocks__/foremanReact/common/MountingService.js
|
|
484
|
-
- webpack/__mocks__/foremanReact/common/helpers.js
|
|
485
481
|
- webpack/__mocks__/foremanReact/components/ConfirmModal/index.js
|
|
486
482
|
- webpack/__mocks__/foremanReact/components/Head.js
|
|
487
483
|
- webpack/__mocks__/foremanReact/components/HostsIndex/index.js
|
|
488
484
|
- webpack/__mocks__/foremanReact/components/Layout/LayoutConstants.js
|
|
489
485
|
- webpack/__mocks__/foremanReact/components/ToastsList/index.js
|
|
490
486
|
- webpack/__mocks__/foremanReact/components/common/dates/RelativeDateTime.js
|
|
491
|
-
- webpack/__mocks__/foremanReact/constants.js
|
|
492
487
|
- webpack/__mocks__/foremanReact/redux.js
|
|
493
|
-
- webpack/__mocks__/foremanReact/redux/API/APISelectors.js
|
|
494
|
-
- webpack/__mocks__/foremanReact/redux/API/index.js
|
|
495
488
|
- webpack/__mocks__/foremanReact/redux/middlewares/IntervalMiddleware.js
|
|
496
489
|
- webpack/__mocks__/foremanReact/routes/RouterSelector.js
|
|
497
490
|
- webpack/__mocks__/foremanReact/routes/common/PageLayout/PageLayout.js
|
|
@@ -514,6 +507,7 @@ files:
|
|
|
514
507
|
- webpack/common/table/helpers.js
|
|
515
508
|
- webpack/global_index.js
|
|
516
509
|
- webpack/index.js
|
|
510
|
+
- webpack/test_setup.js
|
|
517
511
|
homepage: https://github.com/theforeman/foreman_rh_cloud
|
|
518
512
|
licenses:
|
|
519
513
|
- GPL-3.0
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
require 'securerandom'
|
|
2
|
-
|
|
3
|
-
module ForemanRhCloud
|
|
4
|
-
class CloudConnector
|
|
5
|
-
CLOUD_CONNECTOR_USER = 'cloud_connector_user'.freeze
|
|
6
|
-
CLOUD_CONNECTOR_TOKEN_NAME = 'Cloud connector access token'.freeze
|
|
7
|
-
CLOUD_CONNECTOR_FEATURE = 'ansible_configure_cloud_connector'.freeze
|
|
8
|
-
|
|
9
|
-
def install
|
|
10
|
-
user = service_user
|
|
11
|
-
token_value = personal_access_token(user)
|
|
12
|
-
target_host = foreman_host
|
|
13
|
-
composer = nil
|
|
14
|
-
|
|
15
|
-
input = {
|
|
16
|
-
:satellite_cloud_connector_user => service_user.login,
|
|
17
|
-
:satellite_cloud_connector_password => token_value,
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
if (http_proxy = ForemanRhCloud.proxy_setting)
|
|
21
|
-
input[:satellite_cloud_connector_http_proxy] = http_proxy
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
Taxonomy.as_taxonomy(target_host.organization, target_host.location) do
|
|
25
|
-
composer = ::JobInvocationComposer.for_feature(
|
|
26
|
-
CLOUD_CONNECTOR_FEATURE,
|
|
27
|
-
[target_host.id],
|
|
28
|
-
input
|
|
29
|
-
)
|
|
30
|
-
composer.trigger!
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
composer.job_invocation
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
def latest_job
|
|
37
|
-
feature_id = RemoteExecutionFeature.find_by_label(CLOUD_CONNECTOR_FEATURE)&.id
|
|
38
|
-
return nil unless feature_id
|
|
39
|
-
JobInvocation.where(:remote_execution_feature_id => feature_id).includes(:task).reorder('foreman_tasks_tasks.started_at DESC').first
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def personal_access_token(user)
|
|
43
|
-
access_token = PersonalAccessToken.find_by_name(CLOUD_CONNECTOR_TOKEN_NAME)
|
|
44
|
-
|
|
45
|
-
access_token&.destroy! # destroy the old token if exists
|
|
46
|
-
|
|
47
|
-
personal_access_token = PersonalAccessToken.new(:name => CLOUD_CONNECTOR_TOKEN_NAME, :user => user)
|
|
48
|
-
token_value = personal_access_token.generate_token
|
|
49
|
-
personal_access_token.save!
|
|
50
|
-
|
|
51
|
-
token_value
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
def service_user
|
|
55
|
-
user = User.find_by_login(CLOUD_CONNECTOR_USER)
|
|
56
|
-
|
|
57
|
-
if user.nil?
|
|
58
|
-
user = User.create!(
|
|
59
|
-
:login => CLOUD_CONNECTOR_USER,
|
|
60
|
-
:password => SecureRandom.base64(255),
|
|
61
|
-
:description => "This is a service user used by cloud connector to talk to the Satellite API",
|
|
62
|
-
:auth_source => AuthSourceInternal.first,
|
|
63
|
-
:admin => true
|
|
64
|
-
)
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
user
|
|
68
|
-
end
|
|
69
|
-
|
|
70
|
-
def foreman_host
|
|
71
|
-
ForemanRhCloud.foreman_host
|
|
72
|
-
end
|
|
73
|
-
end
|
|
74
|
-
end
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import camelCase from 'lodash/camelCase';
|
|
2
|
-
|
|
3
|
-
export const getURIQuery = jest.fn(() => ({}));
|
|
4
|
-
|
|
5
|
-
export const noop = Function.prototype;
|
|
6
|
-
|
|
7
|
-
export const propsToCamelCase = ob => {
|
|
8
|
-
if (typeof ob !== 'object' || ob === null) return ob;
|
|
9
|
-
|
|
10
|
-
return Object.keys(ob).reduce((memo, key) => {
|
|
11
|
-
memo[camelCase(key)] = ob[key];
|
|
12
|
-
return memo;
|
|
13
|
-
}, {});
|
|
14
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
export const STATUS = {
|
|
2
|
-
PENDING: 'PENDING',
|
|
3
|
-
RESOLVED: 'RESOLVED',
|
|
4
|
-
ERROR: 'ERROR',
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const getControllerSearchProps = (
|
|
8
|
-
controller,
|
|
9
|
-
id = 'searchBar',
|
|
10
|
-
canCreateBookmarks = true
|
|
11
|
-
) => ({
|
|
12
|
-
controller,
|
|
13
|
-
autocomplete: {
|
|
14
|
-
id,
|
|
15
|
-
searchQuery: '',
|
|
16
|
-
url: `${controller}/auto_complete_search`,
|
|
17
|
-
useKeyShortcuts: true,
|
|
18
|
-
},
|
|
19
|
-
bookmarks: {
|
|
20
|
-
url: '/api/bookmarks',
|
|
21
|
-
canCreateBookmarks,
|
|
22
|
-
documentationUrl: `4.1.5Searching`,
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { STATUS } from '../../constants';
|
|
2
|
-
|
|
3
|
-
export const selectAPI = state => state.API || {};
|
|
4
|
-
|
|
5
|
-
export const selectAPIByKey = (state, key) => selectAPI(state)[key] || {};
|
|
6
|
-
|
|
7
|
-
export const selectAPIStatus = (state, key) =>
|
|
8
|
-
selectAPIByKey(state, key).status;
|
|
9
|
-
|
|
10
|
-
export const selectAPIPayload = (state, key) =>
|
|
11
|
-
selectAPIByKey(state, key).payload || {};
|
|
12
|
-
|
|
13
|
-
export const selectAPIResponse = (state, key) =>
|
|
14
|
-
selectAPIByKey(state, key).response || {};
|
|
15
|
-
|
|
16
|
-
export const selectAPIError = (state, key) =>
|
|
17
|
-
selectAPIStatus(state, key) === STATUS.ERROR
|
|
18
|
-
? selectAPIResponse(state, key)
|
|
19
|
-
: null;
|
|
20
|
-
|
|
21
|
-
export const selectAPIErrorMessage = (state, key) => {
|
|
22
|
-
const error = selectAPIError(state, key);
|
|
23
|
-
return error && error.message;
|
|
24
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const get = data => ({ type: 'get-some-type', ...data });
|
|
2
|
-
export const put = data => ({ type: 'put-some-type', ...data });
|
|
3
|
-
export const post = data => ({ type: 'post-some-type', ...data });
|
|
4
|
-
export const patch = data => ({ type: 'patch-some-type', ...data });
|
|
5
|
-
|
|
6
|
-
export const API = {
|
|
7
|
-
get: jest.fn(),
|
|
8
|
-
put: jest.fn(),
|
|
9
|
-
post: jest.fn(),
|
|
10
|
-
delete: jest.fn(),
|
|
11
|
-
patch: jest.fn(),
|
|
12
|
-
};
|