example42 / puppet-yum

Puppet module for Yum
Other
43 stars 116 forks source link

Remi repositories on Amazon Linux #158

Closed davividal closed 7 years ago

davividal commented 7 years ago

Expected Behavior

Use remi repositories to install php.

Actual Behavior

Remi repositories relies on yum's $releasever, which resolves to 'latest' on Amazon Linux. Remi's doesn't have a 'latest' endpoint.

Steps to Reproduce the Problem

  1. Boot a fresh EC2 instance
  2. Use https://forge.puppet.com/mayflower/php module
  3. Spend a few hours trying to figure out what's going on

    Specifications

facter -p output:

# facter -p
aio_agent_version => 1.5.3
augeas => {
  version => "1.4.0"
}
disks => {
  xvda => {
    size => "8.00 GiB",
    size_bytes => 8589934592
  }
}
dmi => {
  bios => {
    release_date => "05/12/2016",
    vendor => "Xen",
    version => "4.2.amazon"
  },
  chassis => {
    type => "Other"
  },
  manufacturer => "Xen",
  product => {
    name => "HVM domU",
    serial_number => "...",
    uuid => "..."
  }
}
ec2_metadata => {
  ami-id => "ami-6dd04501",
  ami-launch-index => "0",
  ami-manifest-path => "(unknown)",
  block-device-mapping => {
    ami => "/dev/xvda",
    root => "/dev/xvda"
  },
  hostname => "ip-192-168-4-238.awscompany.lan",
  iam => {
    info => "{
  "Code" : "Success",
  "LastUpdated" : "2016-07-30T14:58:41Z",
  "InstanceProfileArn" : "arn:aws:iam::myawsaccount:instance-profile/site",
  "InstanceProfileId" : "..."
}"
  },
  instance-action => "none",
  instance-id => "i-80d04251",
  instance-type => "t2.small",
  local-hostname => "ip-192-168-4-238.awscompany.lan",
  local-ipv4 => "192.168.4.238",
  mac => "0a:55:40:34:2a:2f",
  metrics => {
    vhostmd => "<?xml version="1.0" encoding="UTF-8"?>"
  },
  network => {
    interfaces => {
      macs => {
        0a:55:40:34:2a:2f => {
          device-number => "0",
          interface-id => "eni-df4bdb87",
          local-hostname => "ip-192-168-4-238.awscompany.lan",
          local-ipv4s => "192.168.4.238",
          mac => "0a:55:40:34:2a:2f",
          owner-id => "myawsaccount",
          security-group-ids => "sg-90c81ef5",
          security-groups => "BACKEND-VPC-DEV",
          subnet-id => "subnet-d02a2a96",
          subnet-ipv4-cidr-block => "192.168.4.0/24",
          vpc-id => "vpc-0eed6c6b",
          vpc-ipv4-cidr-block => "192.168.0.0/16",
          vpc-ipv4-cidr-blocks => "192.168.0.0/16"
        }
      }
    }
  },
  placement => {
    availability-zone => "sa-east-1c"
  },
  profile => "default-hvm",
  public-keys => {
    0 => {
      openssh-key => ""
    }
  },
  reservation-id => "r-0f7ffede",
  security-groups => "BACKEND-VPC-DEV",
  services => {
    domain => "amazonaws.com",
    partition => "aws"
  }
}
ec2_region => sa-east-1
ec2_tag_name => stage-site
ec2_userdata => "..."
facterversion => 3.3.0
filesystems => ext3,ext4
gemhome => /opt/puppetlabs/puppet/lib/ruby/gems/2.1.0
identity => {
  gid => 0,
  group => "root",
  uid => 0,
  user => "root"
}
is_pe => false
is_virtual => true
java_default_home => /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.101.x86_64
java_libjvm_path => /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.101.x86_64/jre/lib/amd64/server
java_major_version => 7
java_patch_level => 101
java_version => 1.7.0_101
kernel => Linux
kernelmajversion => 4.4
kernelrelease => 4.4.11-23.53.amzn1.x86_64
kernelversion => 4.4.11
last_run => Sat Jul 30 12:28:46:729149659 BRT 2016
load_averages => {
  15m => 0.17,
  1m => 0.11,
  5m => 0.23
}
memory => {
  system => {
    available => "1.52 GiB",
    available_bytes => 1628069888,
    capacity => "22.50%",
    total => "1.96 GiB",
    total_bytes => 2100764672,
    used => "450.80 MiB",
    used_bytes => 472694784
  }
}
mountpoints => {
  / => {
    available => "6.11 GiB",
    available_bytes => 6563020800,
    capacity => "21.11%",
    device => "/dev/xvda1",
    filesystem => "ext4",
    options => [
      "rw",
      "noatime",
      "data=ordered"
    ],
    size => "7.75 GiB",
    size_bytes => 8318783488,
    used => "1.64 GiB",
    used_bytes => 1755762688
  }
}
networking => {
  dhcp => "192.168.4.1",
  domain => "awscompany.lan",
  fqdn => "ip-192-168-4-238.awscompany.lan",
  hostname => "ip-192-168-4-238",
  interfaces => {
    eth0 => {
      bindings => [
        {
          address => "192.168.4.238",
          netmask => "255.255.255.0",
          network => "192.168.4.0"
        }
      ],
      bindings6 => [
        {
          address => "fe80::855:40ff:fe34:2a2f",
          netmask => "ffff:ffff:ffff:ffff::",
          network => "fe80::"
        }
      ],
      dhcp => "192.168.4.1",
      ip => "192.168.4.238",
      ip6 => "fe80::855:40ff:fe34:2a2f",
      mac => "0a:55:40:34:2a:2f",
      mtu => 9001,
      netmask => "255.255.255.0",
      netmask6 => "ffff:ffff:ffff:ffff::",
      network => "192.168.4.0",
      network6 => "fe80::"
    },
    lo => {
      bindings => [
        {
          address => "127.0.0.1",
          netmask => "255.0.0.0",
          network => "127.0.0.0"
        }
      ],
      bindings6 => [
        {
          address => "::1",
          netmask => "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
          network => "::1"
        }
      ],
      ip => "127.0.0.1",
      ip6 => "::1",
      mtu => 65536,
      netmask => "255.0.0.0",
      netmask6 => "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff",
      network => "127.0.0.0",
      network6 => "::1"
    }
  },
  ip => "192.168.4.238",
  ip6 => "fe80::855:40ff:fe34:2a2f",
  mac => "0a:55:40:34:2a:2f",
  mtu => 9001,
  netmask => "255.255.255.0",
  netmask6 => "ffff:ffff:ffff:ffff::",
  network => "192.168.4.0",
  network6 => "fe80::",
  primary => "eth0"
}
nginx_version => 1.8.1
os => {
  architecture => "x86_64",
  family => "RedHat",
  hardware => "x86_64",
  name => "Amazon",
  release => {
    full => "4.4.11-23.53.amzn1.x86_64",
    major => "4",
    minor => "4"
  },
  selinux => {
    enabled => false
  }
}
package_provider => yum
partitions => {
  /dev/xvda1 => {
    filesystem => "ext4",
    label => "/",
    mount => "/",
    partlabel => "Linux",
    partuuid => "e3466a0c-3a36-48a8-8bc2-f5ab5ee2afec",
    size => "8.00 GiB",
    size_bytes => 8587820544,
    uuid => "43c07df6-e944-4b25-8fd1-5ff848b584b2"
  }
}
path => /opt/puppetlabs/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin:/root/bin
phpversion => 5.6.24
processors => {
  count => 1,
  isa => "x86_64",
  models => [
    "Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz"
  ],
  physicalcount => 1
}
puppet_vardir => /opt/puppetlabs/puppet/cache
puppetversion => 4.5.3
root_home => /root
ruby => {
  platform => "x86_64-linux",
  sitedir => "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0",
  version => "2.1.9"
}
service_provider => redhat
ssh => { ...
}
system_uptime => {
  days => 0,
  hours => 19,
  seconds => 70054,
  uptime => "19:27 hours"
}
timezone => BRT
virtual => xenhvm

puppet-yum version: 2.1.27 mayflower/php: 4.0.0-beta1

puppet code:

class mymod {
  class { '::php::globals':
    php_version => '5.6'
  }->
  class { '::php':
    manage_repos => true
  }
}
davividal commented 7 years ago

PR: https://github.com/example42/puppet-yum/pull/159

kmcfate commented 7 years ago

This PR broke things in other ways:

Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Evaluation Error: The value 'name' cannot be converted to Numeric. at /etc/puppet/modules/yum/manifests/repo/remi_safe.pp:6:23 on node.

davividal commented 7 years ago

@kmcfate I'm using puppet 4.2.1. What puppet version are you using?

kmcfate commented 7 years ago

Fixed with stringify_facts=false on the agent. Although this is rather annoying, since puppet will not run, so I can't update stringify_facts on the agents with this change enabled.

alvagante commented 7 years ago

I suppose we can easily change $::os['name'] to $::operatingsystem here

davividal commented 7 years ago

@alvagante should I open a new PR?