Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fixed pear issue, added extension LWRP

  • Loading branch information...
commit 900e6460d60c887cfbb51bcb9ca8cb95305bc263 1 parent 5c55fda
@kher kher authored
View
4 libraries/zendserver.rb
@@ -12,7 +12,11 @@ def get_node_id_by_name(name, keyname, secret)
def is_server_bootstrapped(keyname, secret)
system_info = "#{node[:zendserver][:zsmanage]} system-info -N #{keyname} -K #{secret} -U http://#{node[:hostname]}:10081/ZendServer/"
+ Chef::Log.info(system_info)
p = shell_out(system_info)
+ Chef::Log.info("OUT: #{p.stdout}")
+ Chef::Log.info("ERR: #{p.stderr}")
+
!p.stderr.include? "Bootstrap is needed"
end
View
23 providers/extension.rb
@@ -0,0 +1,23 @@
+require 'chef/mixin/shell_out'
+require 'chef/mixin/language'
+include Chef::Mixin::ShellOut
+
+use_inline_resources
+
+action :enable do
+ p=shell_out("#{node[:zendserver][:zsmanage]} extension-on -e #{@new_resource.name} -N #{node[:zendserver][:apikeyname]} -K #{node[:zendserver][:apikeysecret]}")
+ Chef::Log.info("#{node[:zendserver][:zsmanage]} extension-on -e #{@new_resource.name} -N #{node[:zendserver][:apikeyname]} -K #{node[:zendserver][:apikeysecret]}")
+ Chef::Log.debug(p.stdout)
+ if p.stdout.split("\n")[1] =~ /\.?You should restart php after this action/i
+ new_resource.updated_by_last_action(true)
+ end
+end
+
+action :disable do
+ p=shell_out("#{node[:zendserver][:zsmanage]} extension-off -e #{@new_resource} -N #{node[:zendserver][:apikeyname]} -K #{node[:zendserver][:apikeysecret]}")
+ Chef::Log.info("#{node[:zendserver][:zsmanage]} extension-off -e #{@new_resource.name} -N #{node[:zendserver][:apikeyname]} -K #{node[:zendserver][:apikeysecret]}")
+ Chef::Log.debug(p.stdout)
+ if p.stdout.split("\n")[1] =~ /\.?You should restart php after this action/i
+ new_resource.updated_by_last_action(true)
+ end
+end
View
12 providers/pear_channel.rb
@@ -31,7 +31,7 @@ def whyrun_supported?
action :discover do
unless exists?
Chef::Log.info("Discovering pear channel #{@new_resource}")
- execute "pear channel-discover #{@new_resource.channel_name}" do
+ execute "/usr/local/zend/bin/pear channel-discover #{@new_resource.channel_name}" do
action :run
end
end
@@ -40,7 +40,7 @@ def whyrun_supported?
action :add do
unless exists?
Chef::Log.info("Adding pear channel #{@new_resource} from #{@new_resource.channel_xml}")
- execute "pear channel-add #{@new_resource.channel_xml}" do
+ execute "/usr/local/zend/bin/pear channel-add #{@new_resource.channel_xml}" do
action :run
end
end
@@ -50,7 +50,7 @@ def whyrun_supported?
if exists?
update_needed = false
begin
- updated_needed = true if shell_out("pear search -c #{@new_resource.channel_name} NNNNNN").stdout =~ /channel-update/
+ updated_needed = true if shell_out("/usr/local/zend/bin/pear search -c #{@new_resource.channel_name} NNNNNN").stdout =~ /channel-update/
rescue Chef::Exceptions::CommandTimeout
# CentOS can hang on 'pear search' if a channel needs updating
Chef::Log.info("Timed out checking if channel-update needed...forcing update of pear channel #{@new_resource}")
@@ -60,7 +60,7 @@ def whyrun_supported?
# description = "update pear channel #{@new_resource}"
# converge_by(description) do
Chef::Log.info("Updating pear channel #{@new_resource}")
- shell_out!("pear channel-update #{@new_resource.channel_name}")
+ shell_out!("/usr/local/zend/bin/pear channel-update #{@new_resource.channel_name}")
# end
end
end
@@ -69,7 +69,7 @@ def whyrun_supported?
action :remove do
if exists?
Chef::Log.info("Deleting pear channel #{@new_resource}")
- execute "pear channel-delete #{@new_resource.channel_name}" do
+ execute "/usr/local/zend/bin/pear channel-delete #{@new_resource.channel_name}" do
action :run
end
end
@@ -84,7 +84,7 @@ def load_current_resource
private
def exists?
begin
- shell_out!("pear channel-info #{@current_resource.channel_name}")
+ shell_out!("/usr/local/zend/bin/pear channel-info #{@current_resource.channel_name}")
true
rescue Chef::Exceptions::ShellCommandFailed
rescue Mixlib::ShellOut::ShellCommandFailed
View
7 recipes/default.rb
@@ -8,6 +8,10 @@
#
log "adding repository"
+# check before install that a suitable key is provided, if not bail out
+# Chef::Application.fatal!("Zend Server Order number has to be supplied", 2) if node[:zendserver][:ordernumber].nil? || node[:zendserver][:ordernumber].empty?
+# Chef::Application.fatal!("Zend Server Serial has to be supplied", 2) if node[:zendserver][:licensekey].nil? || node[:zendserver][:licensekey].empty?
+
version = node[:zendserver][:version]
phpversion = node[:zendserver][:phpversion]
url = node[:zendserver][:url]
@@ -52,6 +56,7 @@
log "Starting install for package #{package_name}"
package package_name do
:install
+ notifies :restart, 'service[zend-server]', :immediate if node["platform_family"] == "rhel"
end
#HOT FIX for bug ZSRV-10761 at line 4
@@ -65,5 +70,5 @@
# Problem with CentOS api functions if server not restarted
service "zend-server" do
- action :restart
+ action :nothing
end
View
4 resources/extension.rb
@@ -0,0 +1,4 @@
+default_action :enable
+actions :enable, :disable
+
+attribute :extension_name, :kind_of => String, :name_attribute => true
Please sign in to comment.
Something went wrong with that request. Please try again.