sous-chefs / users

Development repository for the users cookbook
https://supermarket.chef.io/cookbooks/users
Apache License 2.0
138 stars 217 forks source link

Fixed new manage_home behaviour that came as a surprise with chef 12.… #353

Closed warp3r closed 8 years ago

warp3r commented 8 years ago

Description

Fixes the new manage_home behaviour that came with Chef 12.14.60

Issues Resolved

With latest chef client, the cookbook did not work as it did not create the home for the user, then it failed because it could not create the .ssh subfolder and place the key there

Check List

…14.60

warp3r commented 8 years ago

Hi there, just run the build for opensuse 13-2 as TravisCI says it fails , and it worked ok:

| => kitchen converge default-opensuse-132 
-----> Starting Kitchen (v1.7.3)
-----> Creating ...
       Bringing machine 'default' up with 'virtualbox' provider...
       ==> default: Box 'bento/opensuse-13.2' could not be found. Attempting to find and install...
           default: Box Provider: virtualbox
           default: Box Version: >= 0
       ==> default: Loading metadata for box 'bento/opensuse-13.2'
           default: URL: https://atlas.hashicorp.com/bento/opensuse-13.2
       ==> default: Adding box 'bento/opensuse-13.2' (v2.2.9) for provider: virtualbox
           default: Downloading: https://atlas.hashicorp.com/bento/boxes/opensuse-13.2/versions/2.2.9/providers/virtualbox.box
==> default: Successfully added box 'bento/opensuse-13.2' (v2.2.9) for 'virtualbox'!
       ==> default: Importing base box 'bento/opensuse-13.2'...
==> default: Matching MAC address for NAT networking...
       ==> default: Checking if box 'bento/opensuse-13.2' is up to date...
       ==> default: Setting the name of the VM: kitchen-users-default-opensuse-132_default_1473919321181_91833
       ==> default: Clearing any previously set network interfaces...
       ==> default: Preparing network interfaces based on configuration...
           default: Adapter 1: nat
       ==> default: Forwarding ports...
           default: 22 => 2222 (adapter 1)
       ==> default: Booting VM...
       ==> default: Waiting for machine to boot. This may take a few minutes...
           default: SSH address: 127.0.0.1:2222
           default: SSH username: vagrant
           default: SSH auth method: private key
           default: Warning: Connection timeout. Retrying...
           default: Warning: Remote connection disconnect. Retrying...
           default: Warning: Remote connection disconnect. Retrying...
           default: Warning: Remote connection disconnect. Retrying...
           default: 
           default: Vagrant insecure key detected. Vagrant will automatically replace
           default: this with a newly generated keypair for better security.
           default: 
           default: Inserting generated public key within guest...
           default: Removing insecure key from the guest if it's present...
           default: Key inserted! Disconnecting and reconnecting using new SSH key...
       ==> default: Machine booted and ready!
       ==> default: Checking for guest additions in VM...
       ==> default: Setting hostname...
       ==> default: Machine not provisioned because `--no-provision` is specified.
       [SSH] Established
       Vagrant instance  created.
       Finished creating  (4m19.30s).
-----> Converging ...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 4.3.2...
       Removing non-cookbook files before transfer
       Preparing data_bags
       Preparing validation.pem
       Preparing client.rb
-----> Installing Chef Omnibus (install only if missing)
       Downloading https://www.chef.io/chef/install.sh to file /tmp/install.sh
       Trying wget...
       Download complete.
       suse 13 x86_64
       Getting information for chef stable  for suse...
       downloading https://omnitruck-direct.chef.io/stable/chef/metadata?v=&p=suse&pv=13&m=x86_64
         to file /tmp/install.sh.2934/metadata.txt
       trying wget...
       sha1 9e4078002ffb604f29ac0fdc92c5a8a13e4e3491
       sha256   78722816dd421fc8bae538fe559c37a59d5fd09c833cd4c97e577c59ecd5bc0f
       url  https://packages.chef.io/stable/el/6/chef-12.14.60-1.el6.x86_64.rpm
       version  12.14.60
       downloaded metadata file looks valid...
       downloading https://packages.chef.io/stable/el/6/chef-12.14.60-1.el6.x86_64.rpm
         to file /tmp/install.sh.2934/chef-12.14.60-1.el6.x86_64.rpm
       trying wget...
       Comparing checksum with sha256sum...

       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

       You are installing an omnibus package without a version pin.  If you are installing
       on production servers via an automated process this is DANGEROUS and you will
       be upgraded without warning on new releases, even to new major releases.
       Letting the version float is only appropriate in desktop, test, development or
       CI/CD environments.

       WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

       Installing chef 
       installing with rpm...
       warning: /tmp/install.sh.2934/chef-12.14.60-1.el6.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
       Preparing...                          ################################# [100%]
       Updating / installing...
          1:chef-12.14.60-1.el6              ################################# [100%]
       Thank you for installing Chef!
       Transferring files to 
       Starting Chef Client, version 12.14.60
       Creating a new client identity for default-opensuse-132 using the validator key.
       resolving cookbooks for run list: ["users_test::test_home_dir"]
       Synchronizing Cookbooks:
         - users_test (1.7.1)
         - users (3.0.0)
       Installing Cookbook Gems:
       Compiling Cookbooks...
       Converging 2 resources
       Recipe: users_test::test_home_dir
         * users_manage[testgroup] action remove (up to date)
         * users_manage[testgroup] action create
           * group[test_user] action create (skipped due to only_if)
           * linux_user[test_user] action create
             - create user test_user
           * directory[/home/test_user/.ssh] action create
             - create new directory /home/test_user/.ssh
             - change mode from '' to '0700'
             - change owner from '' to '9001'
           * template[/home/test_user/.ssh/authorized_keys] action create
             - create new file /home/test_user/.ssh/authorized_keys
             - update content in file /home/test_user/.ssh/authorized_keys from none to 3e45da
             --- /home/test_user/.ssh/authorized_keys   2016-09-15 06:03:29.574771783 +0000
             +++ /home/test_user/.ssh/.chef-authorized_keys20160915-3201-1y484c6    2016-09-15 06:03:29.574771783 +0000
             @@ -1 +1,16 @@
             +# Generated by Chef
             +# Local modifications will be overwritten.
             +
             +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU
             +GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3
             +Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA
             +t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En
             +mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx
             +NrRFi9wrf+M7Q== chefuser@mylaptop.local
             +ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEAklOUpkDHrfHY17SbrmTIpNLTGK9Tjom/BWDSU
             +GPl+nafzlHDTYW7hdI4yZ5ew18JH4JW9jbhUFrviQzM7xlELEVf4h9lFX5QVkbPppSwg0cda3
             +Pbv7kOdJ/MTyBlWXFCR+HAo3FXRitBqxiX1nKhXpHAZsMciLq8V6RjsNAQwdsdMFvSlVK/7XA
             +t3FaoJoAsncM1Q9x5+3V0Ww68/eIFmb1zuUFljQJKprrX88XypNDvjYNby6vw/Pb0rwert/En
             +mZ+AW4OZPnTPI89ZPmVMLuayrD2cE86Z/il8b+gw3r3+1nKatmIkjn2so1d01QraTlMqVSsbx
             +NQCPO0ZZEa1== chefuser@mylaptop.local
             - change mode from '' to '0600'
             - change owner from '' to '9001'
           * group[nfsgroup] action manage (up to date)
           * group[testgroup] action create
             - create group testgroup

         * users_manage[nfsgroup] action remove (up to date)
         * users_manage[nfsgroup] action create
           * group[test_user] action create (skipped due to only_if)
           * linux_user[test_user] action create (up to date)
           * directory[/home/test_user/.ssh] action create (up to date)
           * template[/home/test_user/.ssh/authorized_keys] action create (up to date)
           * group[testgroup] action manage (up to date)
           * group[nfsgroup] action create
             - create group nfsgroup

       Running handlers:
       Running handlers complete
       Chef Client finished, 7/16 resources updated in 03 seconds
       Finished converging  (0m33.25s).
-----> Kitchen is finished. (4m53.66s)

Cheers

lamont-granquist commented 8 years ago

👍

tas50 commented 8 years ago

Thanks @warp3r