Skip to content

Instantly share code, notes, and snippets.

@equick
Created October 11, 2015 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save equick/08da87998037b585b75b to your computer and use it in GitHub Desktop.
Save equick/08da87998037b585b75b to your computer and use it in GitHub Desktop.
* mw-tomcat_selinux[tomcat-examples-instance2] action create
* selinux_policy_port[8029] action addormodify
Recipe: selinux_policy::helper_scripts
* remote_directory[/var/chef/cache/selinux_policy/helper_scripts] action create
Recipe: <Dynamically Defined Resource>
* cookbook_file[/var/chef/cache/selinux_policy/helper_scripts/port_locate.py] action create (up to date)
(up to date)
* execute[selinux-port-8029-addormodify] action run
================================================================================
Error executing action `run` on resource 'execute[selinux-port-8029-addormodify]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '1'
---- Begin output of if /var/chef/cache/selinux_policy/helper_scripts/port_locate.py tcp 8029 ; then
/usr/sbin/semanage port -m -t http_port_t -p tcp 8029
else
/usr/sbin/semanage port -a -t http_port_t -p tcp 8029
fi
----
STDOUT:
STDERR: Traceback (most recent call last):
File "/var/chef/cache/selinux_policy/helper_scripts/port_locate.py", line 37, in <module>
matching_key = find(lambda k: k[0]<=start_port and k[1]>=end_port and k[2]==protocol ,pr.keys())
File "/var/chef/cache/selinux_policy/helper_scripts/port_locate.py", line 20, in find
if f(item):
File "/var/chef/cache/selinux_policy/helper_scripts/port_locate.py", line 37, in <lambda>
matching_key = find(lambda k: k[0]<=start_port and k[1]>=end_port and k[2]==protocol ,pr.keys())
NameError: global name 'start_port' is not defined
ValueError: Port tcp/8029 already defined
---- End output of if /var/chef/cache/selinux_policy/helper_scripts/port_locate.py tcp 8029 ; then
/usr/sbin/semanage port -m -t http_port_t -p tcp 8029
else
/usr/sbin/semanage port -a -t http_port_t -p tcp 8029
fi
----
Ran if /var/chef/cache/selinux_policy/helper_scripts/port_locate.py tcp 8029 ; then
/usr/sbin/semanage port -m -t http_port_t -p tcp 8029
else
/usr/sbin/semanage port -a -t http_port_t -p tcp 8029
fi
returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/selinux_policy/providers/port.rb
52: execute "selinux-port-#{new_resource.port}-addormodify" do
53: command <<-EOT
54: if #{port_defined(new_resource.port, new_resource.protocol)}; then
55: /usr/sbin/semanage port -m -t #{new_resource.secontext} -p #{new_resource.protocol} #{new_resource.port}
56: else
56: else
57: /usr/sbin/semanage port -a -t #{new_resource.secontext} -p #{new_resource.protocol} #{new_resource.port}
58: fi
59: EOT
60: not_if port_defined(new_resource.port, new_resource.protocol, new_resource.secontext)
61: only_if {use_selinux}
62: end
63: end
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/selinux_policy/providers/port.rb:52:in `block in class_from_file'
execute("selinux-port-8029-addormodify") do
action "run"
retries 0
retry_delay 2
default_guard_interpreter :execute
command " if /var/chef/cache/selinux_policy/helper_scripts/port_locate.py tcp 8029 ; then\n /usr/sbin/semanage port -m -t http_port_t -p tcp 8029\n else\n /usr/sbin/semanage port -a -t http_port_t -p tcp 8029\n fi\n"
backup 5
returns 0
declared_type :execute
cookbook_name "tomcat-examples"
not_if "/var/chef/cache/selinux_policy/helper_scripts/port_locate.py tcp 8029 http_port_t"
only_if { #code block }
end
================================================================================
Error executing action `addormodify` on resource 'selinux_policy_port[8029]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
execute[selinux-port-8029-addormodify] (/var/chef/cache/cookbooks/selinux_policy/providers/port.rb line 52) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
---- Begin output of if /var/chef/cache/selinux_policy/helper_scripts/port_locate.py tcp 8029 ; then
/usr/sbin/semanage port -m -t http_port_t -p tcp 8029
else
/usr/sbin/semanage port -a -t http_port_t -p tcp 8029
fi
----
STDOUT:
STDERR: Traceback (most recent call last):
File "/var/chef/cache/selinux_policy/helper_scripts/port_locate.py", line 37, in <module>
matching_key = find(lambda k: k[0]<=start_port and k[1]>=end_port and k[2]==protocol ,pr.keys())
File "/var/chef/cache/selinux_policy/helper_scripts/port_locate.py", line 20, in find
if f(item):
File "/var/chef/cache/selinux_policy/helper_scripts/port_locate.py", line 37, in <lambda>
matching_key = find(lambda k: k[0]<=start_port and k[1]>=end_port and k[2]==protocol ,pr.keys())
NameError: global name 'start_port' is not defined
ValueError: Port tcp/8029 already defined
---- End output of if /var/chef/cache/selinux_policy/helper_scripts/port_locate.py tcp 8029 ; then
/usr/sbin/semanage port -m -t http_port_t -p tcp 8029
else
/usr/sbin/semanage port -a -t http_port_t -p tcp 8029
fi
----
Ran if /var/chef/cache/selinux_policy/helper_scripts/port_locate.py tcp 8029 ; then
/usr/sbin/semanage port -m -t http_port_t -p tcp 8029
else
/usr/sbin/semanage port -a -t http_port_t -p tcp 8029
fi
returned 1
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/mw-tomcat/providers/selinux.rb
45: p = selinux_policy_port "#{port}" do
46: protocol 'tcp'
47: secontext 'http_port_t'
48: end
49: new_resource.updated_by_last_action(new_resource.updated_by_last_action? || p.updated_by_last_action?)
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/mw-tomcat/providers/selinux.rb:45:in `block (2 levels) in class_from_file'
selinux_policy_port("8029") do
action :addormodify
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :selinux_policy_port
cookbook_name "tomcat-examples"
protocol "tcp"
secontext "http_port_t"
port "8029"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment