foreman_puppet 4.1.0 → 5.0.0

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
2
  SHA256:
3
- metadata.gz: 745a9b5da4d9e341965da09876aea703a9a9e40f2bfc989f002e1263aa67547b
4
- data.tar.gz: 2e80676582c1105c5839682d076f2e03ae6240721e46daf04a7c76e0721aafca
3
+ metadata.gz: ad8bedb9a6b0aa20d769da8ad51d57891e3c77da03ed70f2a90cdf9fe7af3ffa
4
+ data.tar.gz: 17d3af41d610400ba081936f7b151d9329ae26b1fd311c81eaf5925a23366841
5
5
  SHA512:
6
- metadata.gz: a246077d90bf3e91c5963bb603680354ee18c94a0e523067d85683ebd48ee4cd4757e88a8438a456438abd6086a3db88087099e69520bdf79f1213ddddb0b282
7
- data.tar.gz: 58f460b97fad16c5d4ca45850d58baf059e70fd72b7ab898369c64200bfe5a3dd3b472d3b52dfdc0f2650061c49604e59a6cafec5b97933ad996d9aed9332640
6
+ metadata.gz: a87e47f5a35f3a45bb6ac4a77f591ee0b85c37f6736972afd97559d35f4c752a7647c0958b3f7a131ef45b75b54b0f1f2cc104b6a6e4d78a847162a54de73d8f
7
+ data.tar.gz: 3a9c0f4ef48ce2e69e46dd1bbe54a488911e9d97261429f2d6d1f01fb48f53679a651beebb5e94a6bcc1c8159319241d260e342327ff018b9e9c3c8f1bb93281
data/README.md CHANGED
@@ -37,9 +37,8 @@ You can install it on Foreman 2.5 to prepare for the Foreman update.
37
37
 
38
38
  |Foreman version|Plugin version|Notes |
39
39
  |---------------|--------------|------------------------------------------|
40
- | ~> 3.4 | ~> 4.1 | Required |
41
- | ~> 3.3 | ~> 4.0 | Required |
42
- | ~> 3.2 | ~> 3.0 | Required |
40
+ | >= 3.3 | ~> 4.0 | Required |
41
+ | >= 3.2 | ~> 3.0 | Required |
43
42
  | ~> 3.1 | ~> 2.0 | Required |
44
43
  | ~> 3.0 | ~> 1.0 | Required |
45
44
  | >= 2.5 | ~> 0.1 | Optional; replaces Core features |
@@ -4,16 +4,20 @@ module ForemanPuppet
4
4
  module Mutations
5
5
  module Hosts
6
6
  module CreateExtensions
7
- PUPPET_PARAMS = %i[
8
- environment
9
- puppetclasses
10
- ].freeze
11
-
12
7
  extend ActiveSupport::Concern
13
8
 
14
9
  included do
10
+ prepend PatchMethods
11
+
15
12
  argument :environment_id, GraphQL::Types::ID, loads: ForemanPuppet::Types::Environment
16
13
  argument :puppetclass_ids, [GraphQL::Types::ID], loads: ForemanPuppet::Types::Puppetclass, as: :puppetclasses
14
+ end
15
+
16
+ module PatchMethods
17
+ PUPPET_PARAMS = %i[
18
+ environment
19
+ puppetclasses
20
+ ].freeze
17
21
 
18
22
  private
19
23
 
@@ -15,8 +15,8 @@ module ForemanPuppet
15
15
  before_destroy EnsureNotUsedBy.new(:hosts, :hostgroups)
16
16
  has_many :environment_classes, dependent: :destroy, inverse_of: :puppetclass
17
17
  has_many :environments, -> { distinct }, through: :environment_classes
18
- has_many :organizations, -> { distinct.reorder(:id) }, through: :environments
19
- has_many :locations, -> { distinct.reorder(:id) }, through: :environments
18
+ has_many :organizations, -> { distinct.reorder(nil) }, through: :environments
19
+ has_many :locations, -> { distinct.reorder(nil) }, through: :environments
20
20
 
21
21
  # rubocop:disable Rails/HasAndBelongsToMany
22
22
  has_and_belongs_to_many :operatingsystems
@@ -1,5 +1,5 @@
1
1
  Foreman::Plugin.register :foreman_puppet do
2
- requires_foreman '>= 3.3.0'
2
+ requires_foreman '>= 3.5.0'
3
3
  # Add Global JS file for extending foreman-core components and routes
4
4
  register_global_js_file 'global'
5
5
 
@@ -225,8 +225,10 @@ Foreman::Plugin.register :foreman_puppet do
225
225
  priority: 100
226
226
  end
227
227
  end
228
- extend_page 'hosts/_list' do |cx|
229
- cx.add_pagelet :hosts_table_column_header, resource_type: 'host', partial: 'hosts/foreman_puppet/form_list_env_field_header', priority: 100
230
- cx.add_pagelet :hosts_table_column_content, resource_type: 'host', partial: 'hosts/foreman_puppet/form_list_env_field_content', priority: 100
228
+ extend_page 'hosts/_list' do |context|
229
+ context.with_profile :puppet, _('Puppet'), default: true do
230
+ add_pagelet :hosts_table_column_header, key: :environment, label: s_('Environment name'), sortable: true, width: '10%', class: 'hidden-xs'
231
+ add_pagelet :hosts_table_column_content, key: :environment, callback: ->(host) { host.environment }, class: 'hidden-xs ellipsis'
232
+ end
231
233
  end
232
234
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanPuppet
2
- VERSION = '4.1.0'.freeze
2
+ VERSION = '5.0.0'.freeze
3
3
  end
@@ -6,7 +6,18 @@ module ForemanPuppet
6
6
  class CreateMutationTest < GraphQLQueryTestCase
7
7
  let(:hostname) { 'my-graphql-host' }
8
8
  let(:tax_location) { FactoryBot.create(:location) }
9
+ let(:location_id) { Foreman::GlobalId.for(tax_location) }
9
10
  let(:organization) { FactoryBot.create(:organization) }
11
+ let(:organization_id) { Foreman::GlobalId.for(organization) }
12
+ let(:domain) { FactoryBot.create(:domain) }
13
+ let(:domain_id) { Foreman::GlobalId.for(domain) }
14
+ let(:operatingsystem) { FactoryBot.create(:operatingsystem, :with_grub, :with_associations) }
15
+ let(:operatingsystem_id) { Foreman::GlobalId.for(operatingsystem) }
16
+ let(:ptable_id) { Foreman::GlobalId.for(operatingsystem.ptables.first) }
17
+ let(:medium_id) { Foreman::GlobalId.for(operatingsystem.media.first) }
18
+ let(:architecture_id) { Foreman::GlobalId.for(operatingsystem.architectures.first) }
19
+ let(:ip) { '192.0.2.1' }
20
+
10
21
  let(:environment) { FactoryBot.create(:environment, locations: [tax_location], organizations: [organization]) }
11
22
  let(:environment_id) { Foreman::GlobalId.for(environment) }
12
23
  let(:puppetclass) { FactoryBot.create(:puppetclass) }
@@ -16,6 +27,14 @@ module ForemanPuppet
16
27
  {
17
28
  name: hostname,
18
29
  environmentId: environment_id,
30
+ ip: ip,
31
+ locationId: location_id,
32
+ organizationId: organization_id,
33
+ domainId: domain_id,
34
+ operatingsystemId: operatingsystem_id,
35
+ ptableId: ptable_id,
36
+ mediumId: medium_id,
37
+ architectureId: architecture_id,
19
38
  puppetclassIds: [puppetclass_id],
20
39
  interfacesAttributes: [
21
40
  {
@@ -37,12 +56,29 @@ module ForemanPuppet
37
56
  mutation createHostMutation(
38
57
  $name: String!,
39
58
  $environmentId: ID,
59
+ $ip: String,
60
+ $locationId: ID!,
61
+ $organizationId: ID!,
62
+ $domainId: ID,
63
+ $operatingsystemId: ID,
64
+ $architectureId: ID,
65
+ $ptableId: ID,
66
+ $mediumId: ID,
40
67
  $puppetclassIds: [ID!],
41
68
  $interfacesAttributes: [InterfaceAttributesInput!]
42
69
  ) {
43
70
  createHost(input: {
44
71
  name: $name,
45
72
  environmentId: $environmentId,
73
+ ip: $ip,
74
+ architectureId: $architectureId,
75
+ locationId: $locationId,
76
+ organizationId: $organizationId,
77
+ domainId: $domainId,
78
+ operatingsystemId: $operatingsystemId,
79
+ architectureId: $architectureId,
80
+ ptableId: $ptableId,
81
+ mediumId: $mediumId,
46
82
  puppetclassIds: $puppetclassIds,
47
83
  interfacesAttributes: $interfacesAttributes,
48
84
  }) {
@@ -72,12 +108,14 @@ module ForemanPuppet
72
108
  assert_equal 1, host.interfaces.count
73
109
  interface = host.interfaces.first
74
110
  assert_equal 'Nic::Bond', interface.type
75
- assert_same_elements %w[eth0 eth1], interface.attached_to.split(', ')
111
+ assert_equal 'eth0, eth1', interface.attached_to
76
112
  assert_equal 'bond0', interface.identifier
77
113
  assert interface.primary
78
114
  assert interface.provision
79
115
  assert interface.managed
80
116
 
117
+ assert_not_nil host.pxe_loader
118
+
81
119
  assert_not_nil data
82
120
  end
83
121
  end
@@ -1,9 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
3
  import { Route, Switch, Redirect } from 'react-router-dom';
4
- import { translate as __ } from 'foremanReact/common/I18n';
5
4
  import { route } from './helpers';
6
- import EmptyPage from './SubTabs/EmptyPage';
7
5
  import Reports from './SubTabs/Reports';
8
6
  import ENCPreview from './SubTabs/ENCPreview';
9
7
 
@@ -12,7 +10,7 @@ const SecondaryTabRoutes = ({ hostName, hostInfo, status }) => (
12
10
  <Route path={route('reports')}>
13
11
  <Reports hostName={hostName} hostInfo={hostInfo} status={status} />
14
12
  </Route>
15
- <Route path={route('assigned')}>
13
+ {/* <Route path={route('assigned')}>
16
14
  <EmptyPage
17
15
  header={__('Assigned classes')}
18
16
  description={__('This tab is still a work in progress')}
@@ -23,7 +21,7 @@ const SecondaryTabRoutes = ({ hostName, hostInfo, status }) => (
23
21
  header={__('Smart class parameters')}
24
22
  description={__('This tab is still a work in progress')}
25
23
  />
26
- </Route>
24
+ </Route> */}
27
25
  <Route path={route('yaml')}>
28
26
  <ENCPreview hostName={hostName} />
29
27
  </Route>
@@ -1,11 +1,7 @@
1
1
  import PropTypes from 'prop-types';
2
2
  import React from 'react';
3
+ import CardTemplate from 'foremanReact/components/HostDetails/Templates/CardItem/CardTemplate';
3
4
  import {
4
- Card,
5
- CardBody,
6
- CardHeader,
7
- CardTitle,
8
- CardExpandableContent,
9
5
  DescriptionList,
10
6
  DescriptionListTerm,
11
7
  DescriptionListGroup,
@@ -23,73 +19,53 @@ const DescriptionCard = ({
23
19
  caProxyId,
24
20
  env,
25
21
  status,
26
- }) => {
27
- const [isExpanded, setIsExpanded] = React.useState(false);
28
- return (
29
- <Card isExpanded={isExpanded} ouiaId="card-template">
30
- <CardHeader onExpand={() => setIsExpanded(v => !v)}>
31
- <CardTitle id="expandable-card-title">{__('Puppet details')}</CardTitle>
32
- </CardHeader>
33
- <CardExpandableContent>
34
- <CardBody>
35
- <DescriptionList isCompact>
36
- <DescriptionListGroup>
37
- <DescriptionListTerm>
38
- {__('Puppet environment')}
39
- </DescriptionListTerm>
40
- <DescriptionListDescription>
41
- <SkeletonLoader
42
- emptyState={<DefaultLoaderEmptyState />}
43
- status={status}
44
- >
45
- {env && (
46
- <a
47
- href={`/foreman_puppet/environments/?search=name+%3D+${env}`}
48
- >
49
- {env}
50
- </a>
51
- )}
52
- </SkeletonLoader>
53
- </DescriptionListDescription>
54
- </DescriptionListGroup>
55
- <DescriptionListGroup>
56
- <DescriptionListTerm>
57
- {__('Puppet Smart Proxy')}
58
- </DescriptionListTerm>
59
- <DescriptionListDescription>
60
- <SkeletonLoader
61
- emptyState={<DefaultLoaderEmptyState />}
62
- status={status}
63
- >
64
- {proxyName && (
65
- <a href={`/smart_proxies/${proxyId}#puppet`}>{proxyName}</a>
66
- )}
67
- </SkeletonLoader>
68
- </DescriptionListDescription>
69
- </DescriptionListGroup>
70
- <DescriptionListGroup>
71
- <DescriptionListTerm>
72
- {__('Puppet CA Smart Proxy')}
73
- </DescriptionListTerm>
74
- <DescriptionListDescription>
75
- <SkeletonLoader
76
- emptyState={<DefaultLoaderEmptyState />}
77
- status={status}
78
- >
79
- {caProxy && (
80
- <a href={`/smart_proxies/${caProxyId}#puppet-ca`}>
81
- {caProxy}
82
- </a>
83
- )}
84
- </SkeletonLoader>
85
- </DescriptionListDescription>
86
- </DescriptionListGroup>
87
- </DescriptionList>
88
- </CardBody>
89
- </CardExpandableContent>
90
- </Card>
91
- );
92
- };
22
+ }) => (
23
+ <CardTemplate header={__('Puppet details')} expandable>
24
+ <DescriptionList isCompact>
25
+ <DescriptionListGroup>
26
+ <DescriptionListTerm>{__('Puppet environment')}</DescriptionListTerm>
27
+ <DescriptionListDescription>
28
+ <SkeletonLoader
29
+ emptyState={<DefaultLoaderEmptyState />}
30
+ status={status}
31
+ >
32
+ {env && (
33
+ <a href={`/foreman_puppet/environments/?search=name+%3D+${env}`}>
34
+ {env}
35
+ </a>
36
+ )}
37
+ </SkeletonLoader>
38
+ </DescriptionListDescription>
39
+ </DescriptionListGroup>
40
+ <DescriptionListGroup>
41
+ <DescriptionListTerm>{__('Puppet Smart Proxy')}</DescriptionListTerm>
42
+ <DescriptionListDescription>
43
+ <SkeletonLoader
44
+ emptyState={<DefaultLoaderEmptyState />}
45
+ status={status}
46
+ >
47
+ {proxyName && (
48
+ <a href={`/smart_proxies/${proxyId}#puppet`}>{proxyName}</a>
49
+ )}
50
+ </SkeletonLoader>
51
+ </DescriptionListDescription>
52
+ </DescriptionListGroup>
53
+ <DescriptionListGroup>
54
+ <DescriptionListTerm>{__('Puppet CA Smart Proxy')}</DescriptionListTerm>
55
+ <DescriptionListDescription>
56
+ <SkeletonLoader
57
+ emptyState={<DefaultLoaderEmptyState />}
58
+ status={status}
59
+ >
60
+ {caProxy && (
61
+ <a href={`/smart_proxies/${caProxyId}#puppet-ca`}>{caProxy}</a>
62
+ )}
63
+ </SkeletonLoader>
64
+ </DescriptionListDescription>
65
+ </DescriptionListGroup>
66
+ </DescriptionList>
67
+ </CardTemplate>
68
+ );
93
69
 
94
70
  DescriptionCard.propTypes = {
95
71
  caProxy: PropTypes.string,
@@ -2,7 +2,9 @@ import { translate as __ } from 'foremanReact/common/I18n';
2
2
 
3
3
  export const SECONDARY_TABS = [
4
4
  { key: 'reports', title: __('Reports') },
5
- { key: 'assigned', title: __('Assigned classes') },
6
- { key: 'smart-classes', title: __('Smart class parameters') },
5
+ /** Hiding the two tabs since they were not implemented yet and shouldn't be part of the release.
6
+ * { key: 'assigned', title: __('Assigned classes') },
7
+ * { key: 'smart-classes', title: __('Smart class parameters') },
8
+ */
7
9
  { key: 'yaml', title: __('ENC Preview') },
8
10
  ];
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_puppet
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.1.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ondřej Ezr
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-12-25 00:00:00.000000000 Z
12
+ date: 2022-11-22 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Allow assigning Puppet environments and classes to the Foreman Hosts.
15
15
  email: