Showing with 65 additions and 8 deletions.
  1. +19 −6 CHANGELOG.md
  2. +12 −1 README.md
  3. +7 −0 files/external_node_v2.rb
  4. +1 −1 metadata.json
  5. +26 −0 spec/unit/foreman_external_node_spec.rb
25 changes: 19 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [11.0.1](https://github.com/theforeman/puppet-foreman/tree/11.0.1) (2019-04-02)

[Full Changelog](https://github.com/theforeman/puppet-foreman/compare/11.0.0...11.0.1)

**Fixed bugs:**

- Fixup yaml facts prior to parsing in node.rb [\#714](https://github.com/theforeman/puppet-foreman/pull/714) ([alexjfisher](https://github.com/alexjfisher))

**Closed issues:**

- Locations and Organizations get turned on by default in 11.0.0 and authentication off [\#711](https://github.com/theforeman/puppet-foreman/issues/711)

**Merged pull requests:**

- Clarify the defaults switched [\#712](https://github.com/theforeman/puppet-foreman/pull/712) ([ekohl](https://github.com/ekohl))

## [11.0.0](https://github.com/theforeman/puppet-foreman/tree/11.0.0) (2019-01-14)

[Full Changelog](https://github.com/theforeman/puppet-foreman/compare/10.0.0...11.0.0)
Expand All @@ -8,30 +24,27 @@

- Remove default repo management [\#708](https://github.com/theforeman/puppet-foreman/pull/708) ([ekohl](https://github.com/ekohl))
- Fixes [\#25787](https://projects.theforeman.org/issues/25787) - Make login and taxonomy settings optional [\#707](https://github.com/theforeman/puppet-foreman/pull/707) ([tbrisker](https://github.com/tbrisker))
- Fixes [\#25170](https://projects.theforeman.org/issues/25170) - Update admin/pass param to initial\_param. [\#701](https://github.com/theforeman/puppet-foreman/pull/701) ([chris1984](https://github.com/chris1984))
- Fixes [\#25170](https://projects.theforeman.org/issues/25170) - Prefix user params with initial\_ [\#701](https://github.com/theforeman/puppet-foreman/pull/701) ([chris1984](https://github.com/chris1984))

**Implemented enhancements:**

- allow puppetlabs-apache 4.x [\#709](https://github.com/theforeman/puppet-foreman/pull/709) ([mmoll](https://github.com/mmoll))
- Fixes [\#23054](https://projects.theforeman.org/issues/23054) - Refactor class inclusion [\#700](https://github.com/theforeman/puppet-foreman/pull/700) ([ekohl](https://github.com/ekohl))
- Declare Foreman group explicitly [\#697](https://github.com/theforeman/puppet-foreman/pull/697) ([ehelms](https://github.com/ehelms))
- Allow single node fact upload [\#692](https://github.com/theforeman/puppet-foreman/pull/692) ([ahmet2mir](https://github.com/ahmet2mir))
- Clean up acceptance tests + make the apt repo parameters [\#687](https://github.com/theforeman/puppet-foreman/pull/687) ([ekohl](https://github.com/ekohl))
- Add hammer plugin for foreman\_ansible [\#686](https://github.com/theforeman/puppet-foreman/pull/686) ([xprazak2](https://github.com/xprazak2))
- Reuse initialize\_http in external\_node\_v2 [\#683](https://github.com/theforeman/puppet-foreman/pull/683) ([ekohl](https://github.com/ekohl))
- Add Puppet 6 support [\#678](https://github.com/theforeman/puppet-foreman/pull/678) ([ekohl](https://github.com/ekohl))
- namespace extlib functions [\#675](https://github.com/theforeman/puppet-foreman/pull/675) ([mmoll](https://github.com/mmoll))

**Fixed bugs:**

- fix foreman config location for ssl = false and use\_vhost = false [\#705](https://github.com/theforeman/puppet-foreman/pull/705) ([Dimonyga](https://github.com/Dimonyga))
- Handle websockets\_encrypt as a boolean [\#702](https://github.com/theforeman/puppet-foreman/pull/702) ([ekohl](https://github.com/ekohl))
- Fix wrong variable name in enc function [\#694](https://github.com/theforeman/puppet-foreman/pull/694) ([ahmet2mir](https://github.com/ahmet2mir))
- Trying to fix rescue syntax in ENC script [\#685](https://github.com/theforeman/puppet-foreman/pull/685) ([qingbo](https://github.com/qingbo))

**Merged pull requests:**

- fix foreman config location for ssl = false and use\_vhost = false [\#705](https://github.com/theforeman/puppet-foreman/pull/705) ([Dimonyga](https://github.com/Dimonyga))
- Clean up acceptance tests + make the apt repo parameters [\#687](https://github.com/theforeman/puppet-foreman/pull/687) ([ekohl](https://github.com/ekohl))

## [10.0.0](https://github.com/theforeman/puppet-foreman/tree/10.0.0) (2018-10-18)

[Full Changelog](https://github.com/theforeman/puppet-foreman/compare/9.2.0...10.0.0)
Expand Down
13 changes: 12 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,22 @@ previous stable release.

### Foreman version compatibility notes

For Foreman 1.16 or older, please use the 9.x release series of this module.
The parameters `locations_enabled`, `organizations_enabled` and `authentication`
will only have any affect on Foreman 1.20 or older, in newer versions these
settings have been removed.

**Warning** Users configuring Foreman 1.20 and earlier will need to pay
particular attention. Some defaults have been flipped, including all user
authentication.

| Setting | module 11.x with 1.20 | module 10.x with 1.20 |
|----------------------------|-----------------------|-----------------------|
| `authentication` (`login`) | false | true |
| `locations_enabled` | true | false |
| `organizations_enabled ` | true | false |

For Foreman 1.16 or older, please use the 9.x release series of this module.

## Types and providers

`foreman_config_entry` can be used to manage settings in Foreman's database, as
Expand Down
7 changes: 7 additions & 0 deletions files/external_node_v2.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,16 @@ def process_all_facts(http_requests)
end
end

def quote_macs! facts
# Adds single quotes to all unquoted mac addresses in the raw yaml fact string
# if they might otherwise be interpreted as base60 ints
facts.gsub!(/: ([0-5][0-9](:[0-5][0-9]){5})$/,": '\\1'")
end

def build_body(certname,filename)
# Strip the Puppet:: ruby objects and keep the plain hash
facts = File.read(filename)
quote_macs! facts if YAML.load('22:22:22:22:22:22').is_a? Integer
puppet_facts = YAML::load(facts.gsub(/\!ruby\/object.*$/,''))
hostname = puppet_facts['values']['fqdn'] || certname

Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "theforeman-foreman",
"version": "11.0.0",
"version": "11.0.1",
"author": "theforeman",
"summary": "Foreman server configuration",
"license": "GPL-3.0+",
Expand Down
26 changes: 26 additions & 0 deletions spec/unit/foreman_external_node_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,30 @@ class Enc
expect(hash['facts']).to be_a(Hash)
end

describe 'quote_macs!' do
require_relative '../../files/external_node_v2.rb'
it 'quotes macs that need quoting' do
yaml = "---\n macaddress: 52:54:00:44:49:56\n"
quote_macs! yaml
expect(yaml).to eql "---\n macaddress: '52:54:00:44:49:56'\n"
end
it "doesn't modify quoted macs" do
yaml = "---\n macaddress: '52:54:00:44:49:56'\n"
result = yaml
quote_macs! result
expect(yaml).to eql result
end
it 'only looks for mac addresses at the end of lines' do
yaml = "---\n foo: 52:54:00:44:49:56 isn't something we're going to modify\n"
result = yaml
quote_macs! result
expect(yaml).to eql result
end
it 'ignores mac addresses that couldn\'t be interpreted as base 60' do
yaml = "---\n macaddress: 52:54:FF:44:49:56\n"
result = yaml
quote_macs! result
expect(yaml).to eql result
end
end
end