kuzushi 0.0.16 → 0.0.17
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.
- data/Rakefile +0 -1
 - data/VERSION +1 -1
 - data/lib/kuzushi.rb +28 -0
 - metadata +1 -11
 
    
        data/Rakefile
    CHANGED
    
    
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            0.0. 
     | 
| 
      
 1 
     | 
    
         
            +
            0.0.17
         
     | 
    
        data/lib/kuzushi.rb
    CHANGED
    
    | 
         @@ -63,6 +63,7 @@ class Kuzushi 
     | 
|
| 
       63 
63 
     | 
    
         
             
            		process :volumes
         
     | 
| 
       64 
64 
     | 
    
         
             
            		process :files
         
     | 
| 
       65 
65 
     | 
    
         
             
            		process :users
         
     | 
| 
      
 66 
     | 
    
         
            +
            		process :crontab
         
     | 
| 
       66 
67 
     | 
    
         | 
| 
       67 
68 
     | 
    
         
             
            		script get("after")
         
     | 
| 
       68 
69 
     | 
    
         
             
            		script get("init") if init?
         
     | 
| 
         @@ -194,6 +195,33 @@ class Kuzushi 
     | 
|
| 
       194 
195 
     | 
    
         
             
            		end
         
     | 
| 
       195 
196 
     | 
    
         
             
            	end
         
     | 
| 
       196 
197 
     | 
    
         | 
| 
      
 198 
     | 
    
         
            +
            	def handle_crontab(src, user = "root", &blk)
         
     | 
| 
      
 199 
     | 
    
         
            +
            		## FIXME - this is getting a little silly calling tmpfile twice - should be able to pass erb to fetch as an opton...
         
     | 
| 
      
 200 
     | 
    
         
            +
            		## unify code for process crontabs + process files
         
     | 
| 
      
 201 
     | 
    
         
            +
            		fetch(src) do |file|
         
     | 
| 
      
 202 
     | 
    
         
            +
            			tmpfile(blk.call) do |tmp|
         
     | 
| 
      
 203 
     | 
    
         
            +
            				task "process crontab for #{user}" do
         
     | 
| 
      
 204 
     | 
    
         
            +
            					shell "crontab -u #{user} #{tmp}"
         
     | 
| 
      
 205 
     | 
    
         
            +
            				end
         
     | 
| 
      
 206 
     | 
    
         
            +
            			end
         
     | 
| 
      
 207 
     | 
    
         
            +
            		end
         
     | 
| 
      
 208 
     | 
    
         
            +
            	end
         
     | 
| 
      
 209 
     | 
    
         
            +
             
     | 
| 
      
 210 
     | 
    
         
            +
            	def process_crontab(cron)
         
     | 
| 
      
 211 
     | 
    
         
            +
            		if cron.template
         
     | 
| 
      
 212 
     | 
    
         
            +
            			handle_crontab("/templates/#{cron.template}", cron.user) do |file|
         
     | 
| 
      
 213 
     | 
    
         
            +
            				@system = system
         
     | 
| 
      
 214 
     | 
    
         
            +
            				t = ERB.new File.read(file), 0, '<>'
         
     | 
| 
      
 215 
     | 
    
         
            +
            				t.result(binding)
         
     | 
| 
      
 216 
     | 
    
         
            +
            			end
         
     | 
| 
      
 217 
     | 
    
         
            +
            		else
         
     | 
| 
      
 218 
     | 
    
         
            +
            			src = cron.source || File.basename(cron.file)
         
     | 
| 
      
 219 
     | 
    
         
            +
            			handle_crontab("/files/#{src}", cron.user) do |file|
         
     | 
| 
      
 220 
     | 
    
         
            +
            				File.read(file)
         
     | 
| 
      
 221 
     | 
    
         
            +
            			end
         
     | 
| 
      
 222 
     | 
    
         
            +
            		end
         
     | 
| 
      
 223 
     | 
    
         
            +
            	end
         
     | 
| 
      
 224 
     | 
    
         
            +
             
     | 
| 
       197 
225 
     | 
    
         
             
            	def process_users(user)
         
     | 
| 
       198 
226 
     | 
    
         
             
            		(user.authorized_keys || []).each do |key|
         
     | 
| 
       199 
227 
     | 
    
         
             
            			task "add authorized_key for user #{user.name}" do
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification 
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: kuzushi
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version 
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.0.17
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors: 
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Orion Henry
         
     | 
| 
         @@ -32,16 +32,6 @@ dependencies: 
     | 
|
| 
       32 
32 
     | 
    
         
             
                  - !ruby/object:Gem::Version 
         
     | 
| 
       33 
33 
     | 
    
         
             
                    version: "0"
         
     | 
| 
       34 
34 
     | 
    
         
             
                version: 
         
     | 
| 
       35 
     | 
    
         
            -
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       36 
     | 
    
         
            -
              name: rush
         
     | 
| 
       37 
     | 
    
         
            -
              type: :runtime
         
     | 
| 
       38 
     | 
    
         
            -
              version_requirement: 
         
     | 
| 
       39 
     | 
    
         
            -
              version_requirements: !ruby/object:Gem::Requirement 
         
     | 
| 
       40 
     | 
    
         
            -
                requirements: 
         
     | 
| 
       41 
     | 
    
         
            -
                - - ">="
         
     | 
| 
       42 
     | 
    
         
            -
                  - !ruby/object:Gem::Version 
         
     | 
| 
       43 
     | 
    
         
            -
                    version: "0"
         
     | 
| 
       44 
     | 
    
         
            -
                version: 
         
     | 
| 
       45 
35 
     | 
    
         
             
            - !ruby/object:Gem::Dependency 
         
     | 
| 
       46 
36 
     | 
    
         
             
              name: ohai
         
     | 
| 
       47 
37 
     | 
    
         
             
              type: :runtime
         
     |