mirror of
				https://github.com/saltstack-formulas/rsyncd-formula.git
				synced 2025-10-31 13:21:40 +01:00 
			
		
		
		
	Merge pull request #3 from martinhoefling/feature/travis-refactor
Feature/travis refactor
This commit is contained in:
		
						commit
						577989ee3b
					
				
							
								
								
									
										35
									
								
								.travis.yml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										35
									
								
								.travis.yml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,35 @@ | ||||
| language: python | ||||
| python: | ||||
|   - '2.7' | ||||
| 
 | ||||
| env: | ||||
|   global: | ||||
|     - BS_PIP_ALLOWED=1 | ||||
|     - BS_ECHO_DEBUG=1 | ||||
|     - SALT_ARGS="-l debug --local --retcode-passthrough --pillar-root=test/pillar --file-root=$PWD" | ||||
|   matrix: | ||||
|     - STATE=rsyncd | ||||
|     - STATE=rsyncd.config | ||||
| 
 | ||||
| before_install: | ||||
|   - sudo apt-get update | ||||
|   - curl -L http://bootstrap.saltstack.org | sudo -E sh -s -- stable | ||||
| 
 | ||||
| install: | ||||
|   - sudo mkdir -p /srv && sudo ln -sfn $PWD /srv/formula | ||||
|   # See what kind of travis box you're on to help with making your states | ||||
|   # compatible with travis | ||||
|   - sudo salt-call grains.items --local | ||||
| 
 | ||||
| script: | ||||
|   - sudo salt-call state.show_sls $STATE $SALT_ARGS | ||||
|   - sudo salt-call state.sls $STATE $SALT_ARGS | ||||
| 
 | ||||
|   # For debugging purpose | ||||
|   - cat /etc/default/rsync | ||||
|   - test -f /etc/rsyncd.conf && cat /etc/rsyncd.conf || echo "No rsyncd.conf" | ||||
| 
 | ||||
|   # Idempotence check | ||||
|   - sudo salt-call state.sls $STATE $SALT_ARGS > /tmp/second | ||||
|   - cat /tmp/second | ||||
|   - bash -c '! grep -q "^Not Run:" /tmp/second' | ||||
							
								
								
									
										14
									
								
								README.rst
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								README.rst
									
									
									
									
									
								
							| @ -1,3 +1,6 @@ | ||||
| .. image:: https://travis-ci.org/martinhoefling/rsyncd-formula.svg?branch=master | ||||
|     :target: https://travis-ci.org/martinhoefling/rsyncd-formula | ||||
| 
 | ||||
| ================ | ||||
| rsyncd-formula | ||||
| ================ | ||||
| @ -18,9 +21,18 @@ Available states | ||||
| ``rsyncd`` | ||||
| ------------ | ||||
| 
 | ||||
| Installs the rsync package, and starts the rsyncd service. | ||||
| Installs the rsync package, and starts the rsyncd service. Note: The rsyncd.conf has to be created manually / via another state. If the state of the config should also be managed via salt, the rsyncd.config state (which pulls rsyncd) should be used instead. | ||||
| 
 | ||||
| ``rsyncd.config`` | ||||
| ------------ | ||||
| 
 | ||||
| Configure the rsync daemon by writing an rsync.conf and rsync secrets (optional). | ||||
| 
 | ||||
| Testing | ||||
| ======= | ||||
| 
 | ||||
| As you can read in .travis.yml, testing is a matter of symlinking this | ||||
| directory to /srv/formula (because we can't use relative paths in file_roots / | ||||
| pillar_roots) and running:: | ||||
| 
 | ||||
|   salt-call state.show_highstate --local --retcode-passthrough --config-dir=test/etc | ||||
|  | ||||
| @ -1,11 +1,23 @@ | ||||
| {% from "rsyncd/map.jinja" import rsyncd with context %} | ||||
| 
 | ||||
| rsyncd_conf_exists: | ||||
|   file.managed: | ||||
|     - name: {{ rsyncd.configfile }} | ||||
|     - contents: | | ||||
|         # This file is created by salt as a dummy, use the config state or override manually | ||||
|         pid file = /var/run/rsyncd.pid | ||||
|         use chroot = yes | ||||
|         read only = yes | ||||
|     - replace: false | ||||
| 
 | ||||
| rsync: | ||||
|   pkg.installed: | ||||
|     - name: {{ rsyncd.pkg }} | ||||
|   service.running: | ||||
|     - name: {{ rsyncd.service }} | ||||
|     - enable: True | ||||
|     - require: | ||||
|       - file: rsyncd_conf_exists | ||||
| 
 | ||||
| {% if grains.os_family == 'Debian' %} | ||||
| /etc/default/rsync: | ||||
|  | ||||
| @ -5,4 +5,10 @@ | ||||
|         'configfile': '/etc/rsyncd.conf', | ||||
|         'secretsfile': '/etc/rsyncd.secrets' | ||||
|     }, | ||||
|     'Arch': { | ||||
|         'pkg': 'rsync', | ||||
|         'service': 'rsyncd', | ||||
|         'configfile': '/etc/rsyncd.conf', | ||||
|         'secretsfile': '/etc/rsyncd.secrets' | ||||
|     }, | ||||
| }, merge=salt['pillar.get']('rsyncd:lookup')) %} | ||||
|  | ||||
							
								
								
									
										1
									
								
								test/pillar/example.sls
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								test/pillar/example.sls
									
									
									
									
									
										Symbolic link
									
								
							| @ -0,0 +1 @@ | ||||
| ../../pillar.example | ||||
							
								
								
									
										3
									
								
								test/pillar/top.sls
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								test/pillar/top.sls
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,3 @@ | ||||
| base: | ||||
|   '*': | ||||
|     - example | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user