itamae 1.0.13 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +6 -0
 - data/lib/itamae/resource/user.rb +6 -6
 - data/lib/itamae/version.txt +1 -1
 - metadata +3 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: cf3ca04345f9e1c2f82343f422c6017c8ccdd982
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: ded46e740f4c6c1845df1dce58ca0f6fff546513
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: db3709e61d480faa823f4ddce0d29f18f988f2f949dc2bd1272b5b0f2160a53070d9e8fd3f14f55a46acbfaa4ec1c70baef4a2958401396fd02fa2db9633b55f
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: c1244f6570776c26d621c6d4053a100a8f44452937240be45502e9af3412b170f91af127ee283fd5237ba56d14c9815340b7f8dd0d90d8047af4d95a3fd0db3d
         
     | 
    
        data/CHANGELOG.md
    ADDED
    
    
    
        data/lib/itamae/resource/user.rb
    CHANGED
    
    | 
         @@ -5,18 +5,18 @@ module Itamae 
     | 
|
| 
       5 
5 
     | 
    
         
             
                class User < Base
         
     | 
| 
       6 
6 
     | 
    
         
             
                  define_attribute :action, default: :create
         
     | 
| 
       7 
7 
     | 
    
         
             
                  define_attribute :username, type: String, default_name: true
         
     | 
| 
       8 
     | 
    
         
            -
                  define_attribute :gid, type:  
     | 
| 
      
 8 
     | 
    
         
            +
                  define_attribute :gid, type: Integer
         
     | 
| 
       9 
9 
     | 
    
         
             
                  define_attribute :home, type: String
         
     | 
| 
       10 
10 
     | 
    
         
             
                  define_attribute :password, type: String
         
     | 
| 
       11 
11 
     | 
    
         
             
                  define_attribute :system_user, type: [TrueClass, FalseClass]
         
     | 
| 
       12 
     | 
    
         
            -
                  define_attribute :uid, type:  
     | 
| 
      
 12 
     | 
    
         
            +
                  define_attribute :uid, type: Integer
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
14 
     | 
    
         
             
                  def set_current_attributes
         
     | 
| 
       15 
15 
     | 
    
         
             
                    current.exist = exist?
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                    if current.exist
         
     | 
| 
       18 
     | 
    
         
            -
                      current.uid = run_specinfra(:get_user_uid, attributes.username).stdout.strip
         
     | 
| 
       19 
     | 
    
         
            -
                      current.gid = run_specinfra(:get_user_gid, attributes.username).stdout.strip
         
     | 
| 
      
 18 
     | 
    
         
            +
                      current.uid = run_specinfra(:get_user_uid, attributes.username).stdout.strip.to_i
         
     | 
| 
      
 19 
     | 
    
         
            +
                      current.gid = run_specinfra(:get_user_gid, attributes.username).stdout.strip.to_i
         
     | 
| 
       20 
20 
     | 
    
         
             
                      current.home = run_specinfra(:get_user_home_directory, attributes.username).stdout.strip
         
     | 
| 
       21 
21 
     | 
    
         
             
                      current.password = current_password
         
     | 
| 
       22 
22 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -24,12 +24,12 @@ module Itamae 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
                  def action_create(options)
         
     | 
| 
       26 
26 
     | 
    
         
             
                    if run_specinfra(:check_user_exists, attributes.username)
         
     | 
| 
       27 
     | 
    
         
            -
                      if attributes.uid && attributes.uid 
     | 
| 
      
 27 
     | 
    
         
            +
                      if attributes.uid && attributes.uid != current.uid
         
     | 
| 
       28 
28 
     | 
    
         
             
                        run_specinfra(:update_user_uid, attributes.username, attributes.uid)
         
     | 
| 
       29 
29 
     | 
    
         
             
                        updated!
         
     | 
| 
       30 
30 
     | 
    
         
             
                      end
         
     | 
| 
       31 
31 
     | 
    
         | 
| 
       32 
     | 
    
         
            -
                      if attributes.gid && attributes.gid 
     | 
| 
      
 32 
     | 
    
         
            +
                      if attributes.gid && attributes.gid != current.gid
         
     | 
| 
       33 
33 
     | 
    
         
             
                        run_specinfra(:update_user_gid, attributes.username, attributes.gid)
         
     | 
| 
       34 
34 
     | 
    
         
             
                        updated!
         
     | 
| 
       35 
35 
     | 
    
         
             
                      end
         
     | 
    
        data/lib/itamae/version.txt
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            1.0 
     | 
| 
      
 1 
     | 
    
         
            +
            1.1.0
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: itamae
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.1.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ryota Arai
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014-12- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-12-22 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: thor
         
     | 
| 
         @@ -146,6 +146,7 @@ extra_rdoc_files: [] 
     | 
|
| 
       146 
146 
     | 
    
         
             
            files:
         
     | 
| 
       147 
147 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       148 
148 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
      
 149 
     | 
    
         
            +
            - CHANGELOG.md
         
     | 
| 
       149 
150 
     | 
    
         
             
            - Gemfile
         
     | 
| 
       150 
151 
     | 
    
         
             
            - LICENSE.txt
         
     | 
| 
       151 
152 
     | 
    
         
             
            - README.md
         
     |