From b1833267740dba19cde35bb97236d872e646797c Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Sat, 11 Jul 2015 13:52:41 +0200 Subject: [PATCH 1/7] Puppet handler fixes * do not use /tmp/puppet-modules, use /etc/puppet instead. /tmp/ is not persistent and being erased on each reboot. * fix puppet 4.x paths compatibility * pin to openstack-keyston version 5.1.0 instead of stable/juno Signed-off-by: Bogdan Dobrelya --- .gitignore | 2 ++ main.yml | 10 +++++----- resources/keystone_puppet/meta.yaml | 2 +- solar/solar/core/handlers/puppet.py | 6 +++--- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.gitignore b/.gitignore index ab1b0ed3..f515d402 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,8 @@ rs/ solar.log x-venv/ +.tmp/ +modules/ celery*.pid celery*.log diff --git a/main.yml b/main.yml index 14158e8f..23a3ec1b 100644 --- a/main.yml +++ b/main.yml @@ -31,16 +31,16 @@ - apt: name=puppet state=present - git: repo=https://github.com/CGenie/hiera-redis dest=/root/hiera-redis - shell: gem build hiera-redis.gemspec && gem install hiera-redis-3.0.0.gem chdir=/root/hiera-redis + - file: path=/etc/puppet/Puppetfile state=touch - template: src=/vagrant/hiera.yaml dest=/etc/puppet/hiera.yaml - file: path=/etc/puppet/hieradata state=directory + # Make paths puppet 4 compatible - file: path=/etc/puppetlabs/code/ state=directory - file: src=/etc/puppet/hiera.yaml dest=/etc/puppetlabs/code/hiera.yaml state=link + - file: src=/etc/puppet/hieradata dest=/etc/puppetlabs/code/hieradata state=link + - file: src=/etc/puppet/modules dest=/etc/puppetlabs/code/modules state=link - apt: name=ruby-dev state=present - - shell: gem install librarian-puppet - - file: path=/tmp/puppet-modules/modules state=directory - - file: path=/tmp/puppet-modules/Puppetfile state=touch - - file: path=/etc/puppet/modules state=absent - - file: src=/tmp/puppet-modules/modules dest=/etc/puppet/modules state=link + - shell: gem install librarian-puppet --no-ri --no-rdoc # Setup additional development tools - apt: name=vim state=present diff --git a/resources/keystone_puppet/meta.yaml b/resources/keystone_puppet/meta.yaml index e55a9055..8ee657ad 100644 --- a/resources/keystone_puppet/meta.yaml +++ b/resources/keystone_puppet/meta.yaml @@ -25,7 +25,7 @@ input: git: schema: {repository: str!, branch: str!} - value: {repository: 'https://github.com/openstack/puppet-keystone', branch: 'stable/juno'} + value: {repository: 'https://github.com/openstack/puppet-keystone', branch: '5.1.0'} # forge: # schema: str! diff --git a/solar/solar/core/handlers/puppet.py b/solar/solar/core/handlers/puppet.py index 34ef1229..a7f5e031 100644 --- a/solar/solar/core/handlers/puppet.py +++ b/solar/solar/core/handlers/puppet.py @@ -98,7 +98,7 @@ class LibrarianPuppet(ResourceSSHMixin): puppetlabs = self._ssh_command( self.resource, - 'sudo', 'cat', '/tmp/puppet-modules/Puppetfile' + 'sudo', 'cat', '/etc/puppet/Puppetfile' ) git = self.resource.args['git'].value @@ -134,14 +134,14 @@ class LibrarianPuppet(ResourceSSHMixin): self._scp_command( self.resource, '/tmp/Puppetfile', - '/tmp/puppet-modules/Puppetfile', + '/etc/puppet/Puppetfile', use_sudo=True ) self._ssh_command( self.resource, 'sudo', 'librarian-puppet', 'install', - cwd='/tmp/puppet-modules' + cwd='/etc/puppet' ) From 77e5deb54472de03f5b3eed254f89b8e0e0e01a0 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Tue, 14 Jul 2015 10:33:54 +0200 Subject: [PATCH 2/7] Fix bools in puppet manifests Capitalized bools ending up in wrong config values, like 'fooparam=True[]'. Use the lower case instead. Signed-off-by: Bogdan Dobrelya --- resources/keystone_puppet/actions/run.pp | 2 +- resources/keystone_puppet/actions/update.pp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/keystone_puppet/actions/run.pp b/resources/keystone_puppet/actions/run.pp index 0ee30186..9724fb2f 100644 --- a/resources/keystone_puppet/actions/run.pp +++ b/resources/keystone_puppet/actions/run.pp @@ -10,7 +10,7 @@ $port = $resource['input']['port']['value'] class {'keystone': package_ensure => 'present', - verbose => True, + verbose => true, catalog_type => 'sql', admin_token => $admin_token, database_connection => "mysql://$db_user:$db_password@$ip/$db_name", diff --git a/resources/keystone_puppet/actions/update.pp b/resources/keystone_puppet/actions/update.pp index eb2ef649..203b14b9 100644 --- a/resources/keystone_puppet/actions/update.pp +++ b/resources/keystone_puppet/actions/update.pp @@ -1,5 +1,5 @@ class {'keystone': - verbose => True, + verbose => true, catalog_type => 'sql', admin_token => '{{ admin_token }}', sql_connection => 'mysql://{{ db_user }}:{{ db_password }}@{{ ip }}/{{ db_name }}', From 952024df863309280cb4d4102d113f521671c0bd Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Wed, 15 Jul 2015 16:17:32 +0200 Subject: [PATCH 3/7] Add resources_compiled.py to gitignore Signed-off-by: Bogdan Dobrelya --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f515d402..18550fc1 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,5 @@ celery*.pid celery*.log *.dot -*.png \ No newline at end of file +*.png +resources_compiled.py From a792df3c63b1bc611c9b6619c1495b14d95bc790 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Thu, 16 Jul 2015 10:41:09 +0200 Subject: [PATCH 4/7] Update librarian puppet data storage path Use /var/lib/puppet for the storage of Puppetfile, installed modules and other librarian data Signed-off-by: Bogdan Dobrelya --- main.yml | 11 ++++++++--- solar/solar/core/handlers/puppet.py | 6 +++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/main.yml b/main.yml index 23a3ec1b..c21cfdec 100644 --- a/main.yml +++ b/main.yml @@ -31,15 +31,20 @@ - apt: name=puppet state=present - git: repo=https://github.com/CGenie/hiera-redis dest=/root/hiera-redis - shell: gem build hiera-redis.gemspec && gem install hiera-redis-3.0.0.gem chdir=/root/hiera-redis - - file: path=/etc/puppet/Puppetfile state=touch - template: src=/vagrant/hiera.yaml dest=/etc/puppet/hiera.yaml - file: path=/etc/puppet/hieradata state=directory # Make paths puppet 4 compatible - file: path=/etc/puppetlabs/code/ state=directory - file: src=/etc/puppet/hiera.yaml dest=/etc/puppetlabs/code/hiera.yaml state=link - - file: src=/etc/puppet/hieradata dest=/etc/puppetlabs/code/hieradata state=link - - file: src=/etc/puppet/modules dest=/etc/puppetlabs/code/modules state=link - apt: name=ruby-dev state=present + - file: path=/var/lib/puppet/modules state=directory + - file: path=/var/lib/puppet/Puppetfile state=touch + - file: path=/etc/puppet/modules state=absent + - file: path=/etc/puppetlabs/code/modules state=absent + - file: path=/etc/puppetlabs/code/hieradata state=absent + - file: src=/var/lib/puppet/modules dest=/etc/puppet/modules state=link + - file: src=/var/lib/puppet/modules dest=/etc/puppetlabs/code/modules state=link + - file: src=/etc/puppet/hieradata dest=/etc/puppetlabs/code/hieradata state=link - shell: gem install librarian-puppet --no-ri --no-rdoc # Setup additional development tools diff --git a/solar/solar/core/handlers/puppet.py b/solar/solar/core/handlers/puppet.py index a7f5e031..50276066 100644 --- a/solar/solar/core/handlers/puppet.py +++ b/solar/solar/core/handlers/puppet.py @@ -98,7 +98,7 @@ class LibrarianPuppet(ResourceSSHMixin): puppetlabs = self._ssh_command( self.resource, - 'sudo', 'cat', '/etc/puppet/Puppetfile' + 'sudo', 'cat', '/var/lib/puppet/Puppetfile' ) git = self.resource.args['git'].value @@ -134,14 +134,14 @@ class LibrarianPuppet(ResourceSSHMixin): self._scp_command( self.resource, '/tmp/Puppetfile', - '/etc/puppet/Puppetfile', + '/var/lib/puppet/Puppetfile', use_sudo=True ) self._ssh_command( self.resource, 'sudo', 'librarian-puppet', 'install', - cwd='/etc/puppet' + cwd='/var/lib/puppet' ) From 8832c54b5156b5d25acf7fab779c05c1f3b52643 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Thu, 16 Jul 2015 14:04:10 +0200 Subject: [PATCH 5/7] Fix puppet owner for librarian storage Signed-off-by: Bogdan Dobrelya --- main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.yml b/main.yml index c21cfdec..9b1ad0f8 100644 --- a/main.yml +++ b/main.yml @@ -37,8 +37,8 @@ - file: path=/etc/puppetlabs/code/ state=directory - file: src=/etc/puppet/hiera.yaml dest=/etc/puppetlabs/code/hiera.yaml state=link - apt: name=ruby-dev state=present - - file: path=/var/lib/puppet/modules state=directory - - file: path=/var/lib/puppet/Puppetfile state=touch + - file: path=/var/lib/puppet/modules state=directory owner=puppet + - file: path=/var/lib/puppet/Puppetfile state=touch owner=puppet - file: path=/etc/puppet/modules state=absent - file: path=/etc/puppetlabs/code/modules state=absent - file: path=/etc/puppetlabs/code/hieradata state=absent From eabc850136f7e99688ad6f3b976bfc5a79291bf7 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Thu, 16 Jul 2015 14:09:32 +0200 Subject: [PATCH 6/7] Fix include path for virtual_resource Signed-off-by: Bogdan Dobrelya --- example-puppet.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/example-puppet.py b/example-puppet.py index 232a3f6e..e818ebdf 100644 --- a/example-puppet.py +++ b/example-puppet.py @@ -7,7 +7,7 @@ from solar.core import resource from solar.core.provider import GitProvider from solar.core import signals from solar.core import validation -from solar.core import virtual_resource as vr +from solar.core.resource import virtual_resource as vr from solar.interfaces.db import get_db From c386b82f5950f663ac5d322f06bd61a006a6c0e7 Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Thu, 16 Jul 2015 15:43:51 +0200 Subject: [PATCH 7/7] Use /var/tmp for librarian puppet storage Signed-off-by: Bogdan Dobrelya --- main.yml | 8 ++++---- solar/solar/core/handlers/puppet.py | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.yml b/main.yml index 9b1ad0f8..e179bc83 100644 --- a/main.yml +++ b/main.yml @@ -37,13 +37,13 @@ - file: path=/etc/puppetlabs/code/ state=directory - file: src=/etc/puppet/hiera.yaml dest=/etc/puppetlabs/code/hiera.yaml state=link - apt: name=ruby-dev state=present - - file: path=/var/lib/puppet/modules state=directory owner=puppet - - file: path=/var/lib/puppet/Puppetfile state=touch owner=puppet + - file: path=/var/tmp/puppet/modules state=directory owner=puppet + - file: path=/var/tmp/puppet/Puppetfile state=touch owner=puppet - file: path=/etc/puppet/modules state=absent - file: path=/etc/puppetlabs/code/modules state=absent - file: path=/etc/puppetlabs/code/hieradata state=absent - - file: src=/var/lib/puppet/modules dest=/etc/puppet/modules state=link - - file: src=/var/lib/puppet/modules dest=/etc/puppetlabs/code/modules state=link + - file: src=/var/tmp/puppet/modules dest=/etc/puppet/modules state=link + - file: src=/var/tmp/puppet/modules dest=/etc/puppetlabs/code/modules state=link - file: src=/etc/puppet/hieradata dest=/etc/puppetlabs/code/hieradata state=link - shell: gem install librarian-puppet --no-ri --no-rdoc diff --git a/solar/solar/core/handlers/puppet.py b/solar/solar/core/handlers/puppet.py index 50276066..5ddbd1f0 100644 --- a/solar/solar/core/handlers/puppet.py +++ b/solar/solar/core/handlers/puppet.py @@ -98,7 +98,7 @@ class LibrarianPuppet(ResourceSSHMixin): puppetlabs = self._ssh_command( self.resource, - 'sudo', 'cat', '/var/lib/puppet/Puppetfile' + 'sudo', 'cat', '/var/tmp/puppet/Puppetfile' ) git = self.resource.args['git'].value @@ -134,14 +134,14 @@ class LibrarianPuppet(ResourceSSHMixin): self._scp_command( self.resource, '/tmp/Puppetfile', - '/var/lib/puppet/Puppetfile', + '/var/tmp/puppet/Puppetfile', use_sudo=True ) self._ssh_command( self.resource, 'sudo', 'librarian-puppet', 'install', - cwd='/var/lib/puppet' + cwd='/var/tmp/puppet' )