Bernd Weber
2013-Sep-30 18:02 UTC
[Puppet Users] facter behaves different for different users
Hey all, I''ve been trying to get EC2 facts working with the open source edition. I changed the code for ec2.rb and util/ec2.rb according to the master branch on Github(https://github.com/puppetlabs/facter). And testing the code with a ''facter'' call seems to work fine. I can see all the EC2 information. Now when I run Puppet and ask for the global variable (e.g. $::ec_ami_id) it is empty. Manual testing shows that running ''facter -d -p'' as myself (non-root user) and as root results in different output. Has anybody observed this issue before and maybe an idea on what might be going wrong here? Any help is greatly appreciated! My Puppet version is 3.3.0 My Facter version is 1.7.3 Environment is Ubuntu 12.04 on an Amazon EC2 instance Sensitive information has been <removed>! ;) Running ''facter -d -p'' as root shows: Relative directory ./facter removed from search path. Found no suitable resolves of 1 for zonename value for zonename is still nil Found no suitable resolves of 1 for selinux_current_mode value for selinux_current_mode is still nil value for pe_version is still nil value for puppi_projects is still nil Found no suitable resolves of 2 for iphostnumber value for iphostnumber is still nil value for zfs_version is still nil value for pe_version is still nil Found no suitable resolves of 1 for pe_patch_version value for pe_patch_version is still nil Found no suitable resolves of 1 for selinux_policyversion value for selinux_policyversion is still nil Found no suitable resolves of 1 for operatingsystemmajrelease value for operatingsystemmajrelease is still nil value for pe_version is still nil Found no suitable resolves of 1 for pe_minor_version value for pe_minor_version is still nil Found no suitable resolves of 1 for selinux_enforced value for selinux_enforced is still nil value for cfkey is still nil Found no suitable resolves of 1 for xendomains value for xendomains is still nil Found no suitable resolves of 1 for selinux_mode value for selinux_mode is still nil value for pe_version is still nil Found no suitable resolves of 1 for pe_major_version value for pe_major_version is still nil value for vlans is still nil Found no suitable resolves of 1 for selinux_config_policy value for selinux_config_policy is still nil Found no suitable resolves of 2 for processor value for processor is still nil value for macaddress_lo is still nil value for zpool_version is still nil value for ipaddress6 is still nil Found no suitable resolves of 1 for selinux_config_mode value for selinux_config_mode is still nil value for lsbrelease is still nil value for pe_version is still nil value for ipaddress6_lo is still nil value for iptables_persistent_version is still nil value for ipaddress6_eth0 is still nil architecture => amd64 augeasversion => 0.10.0 blockdevice_xvda1_size => 8589934592 blockdevices => xvda1 concat_basedir => /var/lib/puppet/concat domain => ec2.internal facterversion => 1.7.3 filesystems => btrfs,ext2,ext3,ext4,iso9660,msdos,ufs,vfat,xfs fqdn => ip-10-0-0-55.ec2.internal getent_group => root:x:0:|daemon:x:1:|bin:x:2:|sys:x:3:|adm:x:4:ubuntu|tty:x:5:|disk:x:6:|lp:x:7:|mail:x:8:|news:x:9:|uucp:x:10:|man:x:12:|proxy:x:13:|kmem:x:15:|dialout:x:20:ubuntu|fax:x:21:|voice:x:22:|cdrom:x:24:ubuntu|floppy:x:25:ubuntu|tape:x:26:|sudo:x:27:|audio:x:29:ubuntu|dip:x:30:ubuntu|www-data:|backup:x:34:|operator:x:37:|list:x:38:|irc:x:39:|src:x:40:|gnats:x:41:|shadow:x:42:|utmp:x:43:|video:x:44:ubuntu|sasl:x:45:|plugdev:x:46:ubuntu|staff:x:50:bweber|games:x:60:|users:x:100:|nogroup:x:65534:|libuuid:x:101:|crontab:x:102:|syslog:x:103:|fuse:x:104:|messagebus:x:105:|whoopsie:x:106:|mlocate:x:107:|ssh:x:108:|landscape:x:109:|netdev:x:110:ubuntu|admin:x:111:ubuntu|ubuntu:x:1000:|puppet:x:112:|Debian-exim:x:113:|bweber:x:2001:| getent_passwd => root:x:0:0:root:/root:/bin/bash|daemon:x:1:1:daemon:/usr/sbin:/bin/sh|bin:x:2:2:bin:/bin:/bin/sh|sys:x:3:3:sys:/dev:/bin/sh|sync:x:4:65534:sync:/bin:/bin/sync|games:x:5:60:games:/usr/games:/bin/sh|man:x:6:12:man:/var/cache/man:/bin/sh|lp:x:7:7:lp:/var/spool/lpd:/bin/sh|mail:x:8:8:mail:/var/mail:/bin/sh|news:x:9:9:news:/var/spool/news:/bin/sh|uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh|proxy:x:13:13:proxy:/bin:/bin/sh|www-data:x:33:33:www-data:/var/www:/bin/sh|backup:x:34:34:backup:/var/backups:/bin/sh|list:x:38:38:Mailing List Manager:/var/list:/bin/sh|irc:x:39:39:ircd:/var/run/ircd:/bin/sh|gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh|nobody:x:65534:65534:nobody:/nonexistent:/bin/sh|libuuid:x:100:101::/var/lib/libuuid:/bin/sh|syslog:x:101:103::/home/syslog:/bin/false|messagebus:x:102:105::/var/run/dbus:/bin/false|whoopsie:x:103:106::/nonexistent:/bin/false|landscape:x:104:109::/var/lib/landscape:/bin/false|sshd:x:105:65534::/var/run/sshd:/usr/sbin/nologin|ubuntu:x:1000:1000:Ubuntu:/home/ubuntu:/bin/bash|puppet:x:106:112:Puppet configuration management daemon,,,:/var/lib/puppet:/bin/false|Debian-exim:x:107:113::/var/spool/exim4:/bin/false|bweber:x:2001:2001:bweber Puppet-managed User:/home/bweber:/bin/bash| hardwareisa => x86_64 hardwaremodel => x86_64 hostname => ip-10-0-0-55 id => root interfaces => eth0,lo ip6tables_version => 1.4.12 ipaddress => 10.0.0.55 ipaddress_eth0 => 10.0.0.55 ipaddress_lo => 127.0.0.1 iptables_version => 1.4.12 is_pe => false is_virtual => true kernel => Linux kernelmajversion => 3.2 kernelrelease => 3.2.0-40-virtual kernelversion => 3.2.0 last_run => Mon Sep 30 17:34:25 UTC 2013 lsbdistcodename => precise lsbdistdescription => Ubuntu 12.04.3 LTS lsbdistid => Ubuntu lsbdistrelease => 12.04 lsbmajdistrelease => 12 macaddress => <removed> macaddress_eth0 => <removed> memoryfree => 453.29 MB memoryfree_mb => 453.29 memorysize => 590.19 MB memorysize_mb => 590.19 memorytotal => 590.19 MB mtu_eth0 => 1500 mtu_lo => 16436 netmask => 255.255.255.0 netmask_eth0 => 255.255.255.0 netmask_lo => 255.0.0.0 network_eth0 => 10.0.0.0 network_lo => 127.0.0.0 operatingsystem => Ubuntu operatingsystemrelease => 12.04 osfamily => Debian path => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin physicalprocessorcount => 1 postgres_default_version => 9.1 processor0 => Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz processorcount => 1 ps => ps -ef puppet_vardir => /var/lib/puppet puppetversion => 3.3.0 root_home => /root rubysitedir => /usr/local/lib/site_ruby/1.8 rubyversion => 1.8.7 selinux => false sshdsakey => <removed> sshfp_dsa => SSHFP 2 1 <removed> SSHFP 2 2 <removed> sshfp_ecdsa => SSHFP 3 1 <removed> SSHFP 3 2 <removed> sshfp_rsa => SSHFP 1 1 <removed> SSHFP 1 2 <removed> sshrsakey => <removed> swapfree => 0.00 MB swapfree_mb => 0.00 swapsize => 0.00 MB swapsize_mb => 0.00 timezone => UTC uniqueid => <removed> uptime => 1:38 hours uptime_days => 0 uptime_hours => 1 uptime_seconds => 5895 virtual => xen as myself (bweber): Found no suitable resolves of 1 for selinux_current_mode value for selinux_current_mode is still nil Found no suitable resolves of 1 for xendomains value for xendomains is still nil Found no suitable resolves of 1 for zonename value for zonename is still nil value for zpool_version is still nil Found no suitable resolves of 2 for processor value for processor is still nil value for cfkey is still nil No user-data present at http://169.254.169.254/latest/user-data/: server responded with 404 Not Found value for ec2_userdata is still nil value for ipaddress6_lo is still nil value for vlans is still nil Found no suitable resolves of 1 for selinux_enforced value for selinux_enforced is still nil Found no suitable resolves of 1 for selinux_config_mode value for selinux_config_mode is still nil value for ipaddress6_eth0 is still nil value for macaddress_lo is still nil Found no suitable resolves of 1 for selinux_policyversion value for selinux_policyversion is still nil value for lsbrelease is still nil Found no suitable resolves of 1 for selinux_mode value for selinux_mode is still nil value for ipaddress6 is still nil value for zfs_version is still nil Found no suitable resolves of 2 for iphostnumber value for iphostnumber is still nil Found no suitable resolves of 1 for operatingsystemmajrelease value for operatingsystemmajrelease is still nil Found no suitable resolves of 1 for selinux_config_policy value for selinux_config_policy is still nil architecture => amd64 augeasversion => 0.10.0 blockdevice_xvda1_size => 8589934592 blockdevices => xvda1 domain => ec2.internal ec2_ami_id => ami-<removed> ec2_ami_launch_index => 0 ec2_ami_manifest_path => (unknown) ec2_block_device_mapping_ami => /dev/sda1 ec2_block_device_mapping_ephemeral0 => sdb ec2_block_device_mapping_root => /dev/sda1 ec2_hostname => ip-10-0-0-55 ec2_instance_action => none ec2_instance_id => i-<removed> ec2_instance_type => t1.micro ec2_kernel_id => aki-<removed> ec2_local_hostname => ip-10-0-0-55 ec2_local_ipv4 => 10.0.0.55 ec2_mac => <removed> ec2_metrics_vhostmd => <?xml version="1.0" encoding="UTF-8"?> ec2_network_interfaces_macs_<removed>_device_number => 0 ec2_network_interfaces_macs_<removed>_interface_id => eni-<removed> ec2_network_interfaces_macs_<removed>_ipv4_associations_<removed> => 10.0.0.55 ec2_network_interfaces_macs_<removed>_local_hostname => ip-10-0-0-55 ec2_network_interfaces_macs_<removed>_local_ipv4s => 10.0.0.55 ec2_network_interfaces_macs_<removed>_mac => <removed> ec2_network_interfaces_macs_<removed>_owner_id => <removed> ec2_network_interfaces_macs_<removed>_public_hostname => <removed> ec2_network_interfaces_macs_<removed>_public_ipv4s => <removed> ec2_network_interfaces_macs_<removed>_security_group_ids => <removed> ec2_network_interfaces_macs_<removed>_security_groups => Basic web ec2_network_interfaces_macs_<removed>_subnet_id => subnet-<removed> ec2_network_interfaces_macs_<removed>_subnet_ipv4_cidr_block => 10.0.0.0/24 ec2_network_interfaces_macs_<removed>_vpc_id => vpc-<removed> ec2_network_interfaces_macs_<removed>_vpc_ipv4_cidr_block => 10.0.0.0/16 ec2_placement_availability_zone => us-east-<removed> ec2_profile => default-paravirtual ec2_public_hostname => <removed>.compute-1.amazonaws.com ec2_public_ipv4 => <removed> ec2_public_keys_0_openssh_key => <removed> BerndsMBPPL ec2_reservation_id => <removed> ec2_security_groups => Basic web facterversion => 1.7.3 filesystems => btrfs,ext2,ext3,ext4,iso9660,msdos,ufs,vfat,xfs fqdn => ip-10-0-0-55.ec2.internal hardwareisa => x86_64 hardwaremodel => x86_64 hostname => ip-10-0-0-55 id => bweber interfaces => eth0,lo ipaddress => 10.0.0.55 ipaddress_eth0 => 10.0.0.55 ipaddress_lo => 127.0.0.1 is_virtual => true kernel => Linux kernelmajversion => 3.2 kernelrelease => 3.2.0-40-virtual kernelversion => 3.2.0 lsbdistcodename => precise lsbdistdescription => Ubuntu 12.04.3 LTS lsbdistid => Ubuntu lsbdistrelease => 12.04 lsbmajdistrelease => 12 macaddress => <removed> macaddress_eth0 => <removed> memoryfree => 456.04 MB memoryfree_mb => 456.04 memorysize => 590.19 MB memorysize_mb => 590.19 memorytotal => 590.19 MB mtu_eth0 => 1500 mtu_lo => 16436 netmask => 255.255.255.0 netmask_eth0 => 255.255.255.0 netmask_lo => 255.0.0.0 network_eth0 => 10.0.0.0 network_lo => 127.0.0.0 operatingsystem => Ubuntu operatingsystemrelease => 12.04 osfamily => Debian path => /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games physicalprocessorcount => 1 processor0 => Intel(R) Xeon(R) CPU E5-2650 0 @ 2.00GHz processorcount => 1 ps => ps -ef puppetversion => 3.3.0 rubysitedir => /usr/local/lib/site_ruby/1.8 rubyversion => 1.8.7 selinux => false sshdsakey => <removed> sshecdsakey => <removed> sshfp_dsa => SSHFP 2 1 <removed> SSHFP 2 2 <removed> sshfp_ecdsa => SSHFP 3 1 <removed> SSHFP 3 2 <removed> sshfp_rsa => SSHFP 1 1 <removed> SSHFP 1 2 <removed> sshrsakey => <removed> swapfree => 0.00 MB swapfree_mb => 0.00 swapsize => 0.00 MB swapsize_mb => 0.00 timezone => UTC uniqueid => <removed> uptime => 1:58 hours uptime_days => 0 uptime_hours => 1 uptime_seconds => 7114 virtual => xenu -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Bernd Weber
2013-Oct-10 14:41 UTC
[Puppet Users] Re: facter behaves different for different users
Anybody? -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Oct-11 13:53 UTC
[Puppet Users] Re: facter behaves different for different users
On Thursday, October 10, 2013 9:41:50 AM UTC-5, Bernd Weber wrote:> > Anybody? >I''m not particularly interested in analyzing your transcripts to identify the differences. Would you care to clue us in? In any event, facter output may differ for different users for at least these reasons: - Facter determines some fact values by running commands, and some commands it runs may require privilege to work correctly - Facter may determine some fact values by reading files, and to do so successfully it must have access to those - The external commands Facter runs, and Facter itself, may be influenced by the execution environment, such as environment variables and the executable search path John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Bernd Weber
2013-Oct-11 14:15 UTC
[Puppet Users] Re: facter behaves different for different users
John, thanks for the reply. You know how it is, you attache the output -> "I don''t want to analyze your transcripts", you don''t attach them -> ''Please attach the output otherwise we can''t help you''... Well, let''s move on, shall we. As described on top of the post the issue lies with specifically the EC2 facts. It just seems strange to me that if I run ''facter -p'' as non-root and as root user that i get different output. Now I see your point with the access rights, etc. The funny thing is though that I get *more* output as non-root user than as root user, in my case I get the EC2 facts when not root. Btw. testing a curl on http://169.254.169.254/latest/user-data/ as root clearly shows the data. AND interestingly if you now look at the transcripts ;) as non-root user it even complains about a 404 on that address (No user-data present at http://169.254.169.254/latest/user-data/: server responded with 404 Not Found) while then still showing the EC2 facts. So this is the core of the problem. I''d be interested in hearing about whether this might be a known issue, something new or whether I''m on the completely wrong track here because I forgot something very obvious and stupid. I''m open to suggestions and helpful input and will be the first to admit if I made a stupid mistake. I''m just really hoping that some of you master Puppet/Facter folk have an idea what is going on here. Thanks! On Friday, October 11, 2013 6:53:41 AM UTC-7, jcbollinger wrote:> > > > On Thursday, October 10, 2013 9:41:50 AM UTC-5, Bernd Weber wrote: >> >> Anybody? >> > > I''m not particularly interested in analyzing your transcripts to identify > the differences. Would you care to clue us in? > > In any event, facter output may differ for different users for at least > these reasons: > > - Facter determines some fact values by running commands, and some > commands it runs may require privilege to work correctly > - Facter may determine some fact values by reading files, and to do so > successfully it must have access to those > - The external commands Facter runs, and Facter itself, may be > influenced by the execution environment, such as environment variables and > the executable search path > > > John > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
jcbollinger
2013-Oct-11 14:20 UTC
[Puppet Users] Re: facter behaves different for different users
On Friday, October 11, 2013 8:53:41 AM UTC-5, jcbollinger wrote:> > > I''m not particularly interested in analyzing your transcripts to identify > the differences. Would you care to clue us in? > >Sorry, you did mention the $::ec* facts, and I see that they are present in one output and not the other. My general comments still apply, but let me take a quick look at the implementation of those facts... Ok, unless you truncated the output from the root run, there is an important difference in the ''virtual'' fact. By default, Facter will provide EC2 facts only if virtual == xenu. Following up on that... Hmmm. The ''virtual'' fact should never get value "xen" when the machine is found to have a Linux kernel (at least with the most recent Facter). Are you sure the ''virtual'' fact hasn''t been truncated? Else I am inclined to suspect that your Facter is borked -- perhaps from having multiple versions installed simultaneously, or from performing a source install on top of a package install, or vise versa. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.
Bernd Weber
2013-Oct-11 14:23 UTC
[Puppet Users] Re: facter behaves different for different users
Thanks John appreciate this feedback. I did not see that. Let me do some testing and research. There might be something to this. Not sure why there would be several versions installed but better to double-check. I''ll get back to you after some more digging. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users. For more options, visit https://groups.google.com/groups/opt_out.