On 12/01/2010 04:16 PM, Mohammed Morsi wrote:
>    also small fix to iwhd service to make use of service status
> ---
>   contrib/deltacloud_recipe.spec            |    5 +++-
>   deltacloud_recipe/manifests/deltacloud.pp |   21 ++++++++-------
>   deltacloud_recipe/manifests/postgres.pp   |   38 
> -----------------------------
>   deltacloud_recipe/manifests/time.pp       |    8 ------
>   4 files changed, 15 insertions(+), 57 deletions(-)
>   delete mode 100644 deltacloud_recipe/manifests/postgres.pp
>   delete mode 100644 deltacloud_recipe/manifests/time.pp
>
> diff --git a/contrib/deltacloud_recipe.spec b/contrib/deltacloud_recipe.spec
> index 0ec1b2d..eb73cce 100644
> --- a/contrib/deltacloud_recipe.spec
> +++ b/contrib/deltacloud_recipe.spec
> @@ -4,7 +4,7 @@
>   Summary:  DeltaCloud Puppet Recipe
>   Name:     deltacloud_recipe
>   Version:  0.0.3
> -Release:  1%{?dist}
> +Release:  2%{?dist}
>
>   Group:    Applications/Internet
>   License:  GPLv2+
> @@ -50,6 +50,9 @@ rm -rf %{buildroot}
>   %{dchome}
>
>   %changelog
> +* Fri Nov 19 2010 Mohammed Morsi<[email protected]>  0.0.3-2
> +- pull in external firewall, ntp, and postgres puppet modules
> +
>   * Wed Sep 29 2010 Mohammed Morsi<[email protected]>  0.0.3-1
>   - Renamed package from deltacloud appliance
>   - to deltacloud recipe
> diff --git a/deltacloud_recipe/manifests/deltacloud.pp 
> b/deltacloud_recipe/manifests/deltacloud.pp
> index 8abb45b..0fed4c5 100644
> --- a/deltacloud_recipe/manifests/deltacloud.pp
> +++ b/deltacloud_recipe/manifests/deltacloud.pp
> @@ -1,10 +1,10 @@
>   # Deltacloud puppet definitions
>
>   import "firewall"
> +import "ntp"
>   import "postgres"
>   import "rails"
>   import "selinux"
> -import "time"
>
>   # Setup repos which to pull deltacloud components
>   define dc::repos(){
> @@ -146,8 +146,7 @@ define dc::selinux(){
>
>   # Setup firewall for deltacloud
>   define dc::firewall(){
> -  firewall::setup{'deltacloud': status=>"enabled"}
> -  firewall_open_port{"httpd":   port =>  "80", policy =>  "tcp"}
> +  firewall::rule{"http": destination_port =>  '80'}
>   }
>
>   # TODO disable selinux until we're sure everything works w/ it enabled
> @@ -175,7 +174,7 @@ define dc::service::start(){
>       }
>
>       'core':  {
> -      time::sync{"deltacloud":} # we need to sync time to communicate w/ 
> cloud providers
> +      include ntp::client # we need to sync time to communicate w/ cloud 
> providers
>         file {"/etc/init.d/deltacloud-core":
>               source =>  "puppet:///deltacloud_recipe/deltacloud-core",
>               mode   =>  755 }
> @@ -263,7 +262,8 @@ define dc::service::stop(){
>           require =>  Service[iwhd]}
>         service { 'iwhd':
>           ensure  =>  'stopped',
> -        enable  =>  false}
> +        enable  =>  false,
> +        hasstatus =>  true}
>       }
>
>       'image-factory':  {
> @@ -326,13 +326,12 @@ define dc::db(){
>     # to make the db that gets setup configurable
>     file { "/var/lib/pgsql/data/pg_hba.conf":
>              source =>  "puppet:///deltacloud_recipe/pg_hba.conf",
> -           require =>  Postgres::Initialize[init_db] }
> -  postgres::initialize{'init_db':}
> -  postgres::start{'start_db': require =>  
> File["/var/lib/pgsql/data/pg_hba.conf"]}
> +           require =>  Exec["pginitdb"] }
> +  include postgres::server
>     postgres::user{"dcloud":
>                      password =>  "v23zj59an",
>                      roles    =>  "CREATEDB",
> -                   require  =>  Postgres::Start[start_db]}
> +                   require  =>  Service["postgresql"]}
>
>
>     # Create deltacloud database
> @@ -355,7 +354,9 @@ define dc::db::destroy(){
>                                       "deltacloud-condor_refreshd",
>                                       "deltacloud-dbomatic",
>                                       "deltacloud-image_builder_service"]}
> -  postgres::user::remove{"dcloud": require =>  
> Rails::Drop::Db["drop_deltacloud_database"]}
> +  postgres::user{"dcloud":
> +                  ensure =>  'dropped',
> +                  require =>  Rails::Drop::Db["drop_deltacloud_database"]}
>   }
>
>   # Create a new site admin aggregator web user
> diff --git a/deltacloud_recipe/manifests/postgres.pp 
> b/deltacloud_recipe/manifests/postgres.pp
> deleted file mode 100644
> index 6a639b4..0000000
> --- a/deltacloud_recipe/manifests/postgres.pp
> +++ /dev/null
> @@ -1,38 +0,0 @@
> -# Some convenience routines for postgres
> -
> -package { ["postgresql", "postgresql-server"]:
> -            ensure =>  "installed", provider =>  "yum" }
> -
> -define postgres::initialize(){
> -  exec{"initialize_postgres":
> -         command =>  "/sbin/service postgresql initdb",
> -         unless =>  "/usr/bin/test -d /var/lib/pgsql/data/pg_log",
> -         require =>  Package["postgresql-server"]}
> -}
> -
> -define postgres::start{
> -  service {"postgresql" :
> -         ensure  =>  running,
> -         enable  =>  true,
> -         require =>  Exec['initialize_postgres']}
> -  # XXX ugly hack, postgres takes sometime to startup even though reporting 
> as running
> -  # need to pause for a bit to ensure it is running before we try to access 
> the db
> -  exec{"postgresql_startup_pause":
> -              command =>  "/bin/sleep 2",
> -              require =>  Service[postgresql]
> -  }
> -}
> -
> -define postgres::user($password="", $roles=""){
> -  exec{"create_dcloud_postgres_user":
> -         unless  =>  "/usr/bin/test `psql postgres postgres -P tuples_only 
> -c \"select count(*) from pg_user where usename='${name}';\"` = \"1\"",
> -         command =>  "/usr/bin/psql postgres postgres -c \
> -                     \"CREATE USER ${name} WITH PASSWORD '${password}' 
> ${roles}\""}
> -}
> -
> -define postgres::user::remove($password="", $roles=""){
> -  exec{"remove_dcloud_postgres_user":
> -         onlyif  =>  "/usr/bin/test `psql postgres postgres -P tuples_only 
> -c \"select count(*) from pg_user where usename='${name}';\"` = \"1\"",
> -         command =>  "/usr/bin/psql postgres postgres -c \
> -                     \"DROP USER ${name}\""}
> -}
> diff --git a/deltacloud_recipe/manifests/time.pp 
> b/deltacloud_recipe/manifests/time.pp
> deleted file mode 100644
> index c3db854..0000000
> --- a/deltacloud_recipe/manifests/time.pp
> +++ /dev/null
> @@ -1,8 +0,0 @@
> -# Some convenience routines for system time manipulation
> -
> -# Sync system time via ntp
> -define time::sync(){
> -  exec{"sync_time":
> -    command  =>  "/usr/sbin/ntpdate pool.ntp.org"
> -  }
> -}

Conditional ACK.  Found the following nit with the downloaded postgres 
module that needs to be address but isn't part of this patch proper.

Notes:  When running this from a completely clean machine, it looks like 
postgres is installed w/ ascii_sql as the default char encoding.  Trying 
to create/migrate db's doesn't play well with default encoding.

- Easiest workaround is to make sure initdb is called with -E UTF8. 
(Currently this module is downloaded instead of part of the repo.)

- Another workaround is to create a copy of postgres template1 and 
explicitly use that on db creates, but that seems like overkill for now.


Mike
_______________________________________________
deltacloud-devel mailing list
[email protected]
https://fedorahosted.org/mailman/listinfo/deltacloud-devel

Reply via email to