Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate all factsets to legacy facts & fix renaming network related facts #225

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions facts/1.6/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 1.6.0",
"architecture": "x86_64",
"kernel": "Linux",
Expand Down
1 change: 1 addition & 0 deletions facts/1.6/fedora-19-i386.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 1.6.0",
"architecture": "i386",
"kernel": "Linux",
Expand Down
1 change: 1 addition & 0 deletions facts/1.6/fedora-19-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 1.6.0",
"architecture": "x86_64",
"kernel": "Linux",
Expand Down
1 change: 1 addition & 0 deletions facts/1.7/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 1.7.0",
"architecture": "x86_64",
"kernel": "Linux",
Expand Down
1 change: 1 addition & 0 deletions facts/2.0/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 2.0.0",
"architecture": "x86_64",
"kernel": "Linux",
Expand Down
1 change: 1 addition & 0 deletions facts/2.1/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 2.1.0",
"architecture": "x86_64",
"kernel": "Linux",
Expand Down
1 change: 1 addition & 0 deletions facts/2.2/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 2.2.0",
"kernel": "Linux",
"system_uptime": {
Expand Down
1 change: 1 addition & 0 deletions facts/2.3/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 2.3.0",
"architecture": "x86_64",
"kernel": "Linux",
Expand Down
1 change: 1 addition & 0 deletions facts/2.4/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 2.4.0",
"kernel": "Linux",
"system_uptime": {
Expand Down
1 change: 1 addition & 0 deletions facts/2.5/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"gem_version": "~> 2.5.0",
"architecture": "x86_64",
"kernel": "Linux",
Expand Down
1 change: 1 addition & 0 deletions facts/3.0/ubuntu-15.10-i386.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"hostname": "foo",
"domain": "example.com",
"fqdn": "foo.example.com",
Expand Down
1 change: 1 addition & 0 deletions facts/3.0/ubuntu-15.10-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"hostname": "foo",
"domain": "example.com",
"fqdn": "foo.example.com",
Expand Down
1 change: 1 addition & 0 deletions facts/3.10/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
"dhcp": "10.0.2.2",
"fqdn": "foo.example.com",
"hostname": "foo",
"domain": "example.com",
"interfaces": {
"eth0": {
"bindings": [
Expand Down
2 changes: 2 additions & 0 deletions facts/3.10/ubuntu-18.04-aarch64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"fqdn": "foo.example.com",
"domain": "example.com",
"hostname": "foo",
Expand Down Expand Up @@ -306,6 +307,7 @@
"dhcp": "192.168.1.1",
"fqdn": "foo.example.com",
"hostname": "foo",
"domain": "example.com",
"interfaces": {
"datapath": {
"bindings6": [
Expand Down
1 change: 1 addition & 0 deletions facts/3.11/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
"dhcp": "10.0.2.2",
"fqdn": "foo.example.com",
"hostname": "foo",
"domain": "example.com",
"interfaces": {
"eth0": {
"bindings": [
Expand Down
2 changes: 1 addition & 1 deletion facts/3.11/solaris-10-i86pc.facts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@
"networking": {
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "myhostname",
"hostname": "foo",
"interfaces": {
"lo0": {
"bindings": [
Expand Down
1 change: 1 addition & 0 deletions facts/3.12/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
"dhcp": "10.0.2.2",
"fqdn": "foo.example.com",
"hostname": "foo",
"domain": "example.com",
"interfaces": {
"eth0": {
"bindings": [
Expand Down
2 changes: 1 addition & 1 deletion facts/3.14/VirtuozzoLinux-7-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@
"dhcp": "169.255.254.1",
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "awesome",
"hostname": "foo",
"interfaces": {
"eth0": {
"bindings": [
Expand Down
1 change: 1 addition & 0 deletions facts/3.14/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,7 @@
"dhcp": "10.0.2.2",
"fqdn": "foo.example.com",
"hostname": "foo",
"domain": "example.com",
"interfaces": {
"eth0": {
"bindings": [
Expand Down
2 changes: 1 addition & 1 deletion facts/3.14/ubuntu-21.04-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@
"dhcp": "8.8.8.8",
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "2104",
"hostname": "foo",
"interfaces": {
"internal": {
"bindings": [
Expand Down
5 changes: 3 additions & 2 deletions facts/3.2/aix-53-powerpc.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"fqdn": "foo.example.com",
"domain": "example.com",
"hostname": "foo",
Expand Down Expand Up @@ -38,8 +39,8 @@
},
"networking": {
"domain": "example.com",
"fqdn": "aix-53.example.com",
"hostname": "aix-53",
"fqdn": "foo.example.com",
"hostname": "foo",
"interfaces": {
"en0": {
"bindings": [
Expand Down
5 changes: 3 additions & 2 deletions facts/3.2/aix-61-powerpc.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"hostname": "foo",
"domain": "example.com",
"fqdn": "foo.example.com",
Expand Down Expand Up @@ -38,8 +39,8 @@
},
"networking": {
"domain": "example.com",
"fqdn": "aix-53.example.com",
"hostname": "aix-53",
"fqdn": "foo.example.com",
"hostname": "foo",
"interfaces": {
"en0": {
"bindings": [
Expand Down
5 changes: 3 additions & 2 deletions facts/3.2/aix-71-powerpc.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"fqdn": "foo.example.com",
"domain": "example.com",
"hostname": "foo",
Expand Down Expand Up @@ -38,8 +39,8 @@
},
"networking": {
"domain": "example.com",
"fqdn": "aix-71.example.com",
"hostname": "aix-71",
"fqdn": "foo.example.com",
"hostname": "foo",
"interfaces": {
"en0": {
"bindings": [
Expand Down
4 changes: 2 additions & 2 deletions facts/3.6/amazon-2017-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,9 @@
"network_lo": "127.0.0.0",
"networking": {
"dhcp": "10.254.253.129",
"domain": "us-gov-west-1.compute.internal",
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "ip-10-254-253-132",
"hostname": "foo",
"interfaces": {
"eth0": {
"bindings": [
Expand Down
3 changes: 2 additions & 1 deletion facts/3.6/pcs-6-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"fqdn": "foo.example.com",
"domain": "example.com",
"hostname": "foo",
Expand Down Expand Up @@ -141,7 +142,7 @@
"networking": {
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "pcs-6-x86_64",
"hostname": "foo",
"interfaces": {
"br0": {
"bindings": [
Expand Down
2 changes: 1 addition & 1 deletion facts/3.9/aix-7.1-power.facts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@
"networking": {
"domain": "example.com",
"fqdn": "foo.example.com",
"hostname": "hostname",
"hostname": "foo",
"interfaces": {
"en0": {
"bindings6": [
Expand Down
1 change: 1 addition & 0 deletions facts/3.9/archlinux-x86_64.facts
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
"networking": {
"dhcp": "10.0.2.2",
"fqdn": "foo.example.com",
"domain": "example.com",
"hostname": "foo",
"interfaces": {
"eth0": {
Expand Down
4 changes: 2 additions & 2 deletions facts/3.9/solaris-10-i86pc.facts
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,8 @@
"network_lo0": "127.0.0.0",
"networking": {
"domain": "example.com",
"fqdn": "hostname",
"hostname": "hostname",
"fqdn": "foo.example.com",
"hostname": "foo",
"interfaces": {
"bnx0": {
"bindings": [
Expand Down
1 change: 1 addition & 0 deletions facts/4.0/centos-7-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"os": {
"family": "RedHat",
"name": "CentOS",
Expand Down
1 change: 1 addition & 0 deletions facts/4.0/debian-10-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"os": {
"architecture": "amd64",
"release": {
Expand Down
1 change: 1 addition & 0 deletions facts/4.0/oraclelinux-7-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"os": {
"family": "RedHat",
"name": "OracleLinux",
Expand Down
1 change: 1 addition & 0 deletions facts/4.0/redhat-7-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"os": {
"family": "RedHat",
"name": "RedHat",
Expand Down
1 change: 1 addition & 0 deletions facts/4.0/scientific-7-x86_64.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"os": {
"family": "RedHat",
"name": "Scientific",
Expand Down
1 change: 1 addition & 0 deletions facts/4.0/solaris-11-sun4v.facts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"ipaddress": "192.168.0.1",
"is_virtual": true,
"solaris_zones": {
"current": "global",
Expand Down
44 changes: 8 additions & 36 deletions spec/facts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,36 +62,6 @@
end
end

KNOWN_IPADDRESS_PENDING = {
'facts/1.6/fedora-19-i386.facts' => 'unable to regenerate facts',
'facts/1.6/fedora-19-x86_64.facts' => 'unable to regenerate facts',
'facts/2.1/archlinux-x86_64.facts' => 'no ifconfig package',
'facts/3.10/ubuntu-18.04-aarch64.facts' => 'unable to regenerate facts',
'facts/1.6/archlinux-x86_64.facts' => 'no ifconfig package',
'facts/2.4/archlinux-x86_64.facts' => 'no ifconfig package',
'facts/3.2/aix-61-powerpc.facts' => 'unable to regenerate facts',
'facts/3.2/aix-71-powerpc.facts' => 'unable to regenerate facts',
'facts/3.2/aix-53-powerpc.facts' => 'unable to regenerate facts',
'facts/2.3/archlinux-x86_64.facts' => 'no ifconfig package',
'facts/2.5/archlinux-x86_64.facts' => 'no ifconfig package',
'facts/1.7/archlinux-x86_64.facts' => 'no ifconfig package',
'facts/2.0/archlinux-x86_64.facts' => 'no ifconfig package',
'facts/2.2/archlinux-x86_64.facts' => 'no ifconfig package',
'facts/3.6/pcs-6-x86_64.facts' => 'unable to regenerate facts',
'facts/3.0/ubuntu-15.10-x86_64.facts' => 'no puppet-agent package',
'facts/3.0/ubuntu-15.10-i386.facts' => 'no puppet-agent package',
}

KNOWN_HOSTNAME_PENDING = {
'facts/3.10/ubuntu-18.04-aarch64.facts' => 'unable to regenerate facts',
'facts/3.2/aix-61-powerpc.facts' => 'unable to regenerate facts',
'facts/3.2/aix-71-powerpc.facts' => 'unable to regenerate facts',
'facts/3.2/aix-53-powerpc.facts' => 'unable to regenerate facts',
'facts/3.6/pcs-6-x86_64.facts' => 'unable to regenerate facts',
'facts/3.0/ubuntu-15.10-x86_64.facts' => 'no puppet-agent package',
'facts/3.0/ubuntu-15.10-i386.facts' => 'no puppet-agent package',
}

project_dir = Pathname.new(__dir__).parent
FacterDB.default_fact_files.each do |filepath|
relative_path = Pathname.new(filepath).relative_path_from(project_dir).to_s
Expand All @@ -110,15 +80,17 @@
expect(content['facterversion']).to have_facter_version(facter_dir_path, filepath)
end

it 'contains an ipaddress or networking.ip fact' do
pending KNOWN_IPADDRESS_PENDING[relative_path] if KNOWN_IPADDRESS_PENDING.key?(relative_path)
case content['facterversion']
when /^[1-3]/
expect(content['ipaddress']).to not_be_nil.and not_be_empty
else
it 'contains newer networking facts hash' do
if Gem::Version.new(content['facterversion']) >= Gem::Version.new('3.0.0')
expect(content['networking']['ip']).to not_be_nil.and not_be_empty
expect(content['networking']['hostname']).to eq('foo')
expect(content['networking']['domain']).to eq('example.com')
expect(content['networking']['fqdn']).to eq('foo.example.com')
end
end
it 'contains the legacy ipaddress fact' do
expect(content['ipaddress']).to not_be_nil.and not_be_empty
end
it 'contains no facts from puppetlabs/stdlib' do
expect(content['root_home']).to be_nil
expect(content['service_provider']).to be_nil
Expand Down