Merge pull request #4 from Martin819/master
Added Kitchen and Travis
diff --git a/.kitchen.yml b/.kitchen.yml
new file mode 100644
index 0000000..b49319d
--- /dev/null
+++ b/.kitchen.yml
@@ -0,0 +1,53 @@
+---
+driver:
+ name: docker
+ hostname: openssh.ci.local
+ use_sudo: false
+
+provisioner:
+ name: salt_solo
+ salt_install: bootstrap
+ salt_bootstrap_url: https://bootstrap.saltstack.com
+ salt_version: latest
+ require_chef: false
+ log_level: error
+ formula: openssh
+ grains:
+ noservices: True
+ state_top:
+ base:
+ "*":
+ - openssh
+ pillars:
+ top.sls:
+ base:
+ "*":
+ - openssh
+ dependencies:
+ - name: linux
+ repo: git
+ source: "https://github.com/salt-formulas/salt-formula-linux"
+
+verifier:
+ name: inspec
+ sudo: true
+
+
+platforms:
+ - name: <%=ENV['PLATFORM'] || 'ubuntu-xenial'%>
+ driver_config:
+ image: <%=ENV['PLATFORM'] || 'trevorj/salty-whales:xenial'%>
+ platform: ubuntu
+
+suites:
+
+ - name: openssh_client
+ provisioner:
+ pillars-from-files:
+ openssh.sls: tests/pillar/openssh_client.sls
+
+ - name: openssh_server
+ provisioner:
+ pillars-from-files:
+ openssh.sls: tests/pillar/openssh_server.sls
+# vim: ft=yaml sw=2 ts=2 sts=2 tw=125
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..cfc4d85
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,29 @@
+sudo: required
+services:
+ - docker
+
+install:
+ - pip install PyYAML
+ - pip install virtualenv
+ - |
+ test -e Gemfile || cat <<EOF > Gemfile
+ source 'https://rubygems.org'
+ gem 'rake'
+ gem 'test-kitchen'
+ gem 'kitchen-docker'
+ gem 'kitchen-inspec'
+ gem 'inspec'
+ gem 'kitchen-salt', :git => 'https://github.com/epcim/kitchen-salt.git', :branch => 'dependencis-pkg-repo2'
+ #Waiting for PR#78
+ #gem 'kitchen-salt', '>=0.2.25'
+ - bundle install
+
+env:
+- PLATFORM=trevorj/salty-whales:trusty
+- PLATFORM=trevorj/salty-whales:xenial
+
+before_script:
+ - make test
+
+script:
+ - test ! -e .kitchen.yml || bundle exec kitchen test
diff --git a/metadata.yml b/metadata.yml
index 8dcfee0..77deea6 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,7 +1,6 @@
name: "openssh"
version: "0.2"
-source: "https://github.com/tcpcloud/salt-formula-openssh"
+source: "https://github.com/salt-formulas/salt-formula-openssh"
dependencies:
- name: linux
- source: "https://github.com/tcpcloud/salt-formula-linux"
-
+ source: "https://github.com/salt-formulas/salt-formula-linux"
diff --git a/openssh/client/service.sls b/openssh/client/service.sls
index aa1fcae..8ae01d5 100644
--- a/openssh/client/service.sls
+++ b/openssh/client/service.sls
@@ -27,6 +27,8 @@
{%- for user_name, user in client.user.iteritems() %}
+{%- if user.get('enabled', True) %}
+
{{ user.user.home }}/.ssh:
file.directory:
- user: {{ user.user.name }}
@@ -45,6 +47,8 @@
- require:
- pkg: openssh_client_packages
+{%- endif %}
+
{%- endfor %}
{%- endif %}
diff --git a/tests/pillar/openssh_client.sls b/tests/pillar/openssh_client.sls
index 6f20eba..da4099b 100644
--- a/tests/pillar/openssh_client.sls
+++ b/tests/pillar/openssh_client.sls
@@ -3,7 +3,7 @@
enabled: true
user:
test:
- enabled: true
+ enabled: false
name: test
user:
enabled: true
diff --git a/tests/pillar/openssh_server.sls b/tests/pillar/openssh_server.sls
index 415f50d..d5e18ac 100644
--- a/tests/pillar/openssh_server.sls
+++ b/tests/pillar/openssh_server.sls
@@ -14,4 +14,6 @@
home: /home/test
public_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCts9Ry.........
-
+ bind:
+ address: 0.0.0.0
+ port: 8000
diff --git a/tests/run_tests.sh b/tests/run_tests.sh
index 3f42101..df9d84b 100755
--- a/tests/run_tests.sh
+++ b/tests/run_tests.sh
@@ -18,7 +18,7 @@
SALT_CONFIG_DIR=${SALT_CONFIG_DIR:-${BUILDDIR}/salt}
SALT_CACHE_DIR=${SALT_CACHE_DIR:-${SALT_CONFIG_DIR}/cache}
-SALT_OPTS="${SALT_OPTS} --retcode-passthrough --local -c ${SALT_CONFIG_DIR}"
+SALT_OPTS="${SALT_OPTS} --retcode-passthrough --local --output-file=${VENV_DIR}/salt_output -c ${SALT_CONFIG_DIR}"
if [ "x${SALT_VERSION}" != "x" ]; then
PIP_SALT_VERSION="==${SALT_VERSION}"