Class: ProviderTesting::Pegasus
- Inherits:
-
Object
- Object
- ProviderTesting::Pegasus
- Defined in:
- lib/provider-testing/pegasus.rb
Overview
Interface class to start/stop Pegasus CIMOM
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#pid ⇒ Object
readonly
Returns the value of attribute pid.
-
#providers_dir ⇒ Object
readonly
Returns the value of attribute providers_dir.
-
#registration_dir ⇒ Object
readonly
Returns the value of attribute registration_dir.
-
#stage_dir ⇒ Object
readonly
Returns the value of attribute stage_dir.
-
#uri ⇒ Object
readonly
return uri to connect to.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Pegasus
constructor
start Pegasus.
-
#mkcfg ⇒ Object
make Pegasus configuration.
-
#start ⇒ Object
start Pegasus.
-
#stop ⇒ Object
stop Pegasus.
Constructor Details
#initialize(args = {}) ⇒ Pegasus
start Pegasus
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/provider-testing/pegasus.rb', line 38 def initialize args = {} @execfile = "/usr/sbin/cimserver" @port = 12345 @pid = nil @config = {} tmpdir = args[:tmpdir] || Dir.tmpdir File.directory?(tmpdir) || Dir.mkdir(tmpdir) @dir = File.join(tmpdir, "pegasus") Dir.mkdir @dir rescue nil STDERR.puts "Pegasus directory at #{@dir}" # location of cmpi-bindings for Ruby @providers_dir = File.(File.join(TOPLEVEL,"..","..","build","swig","ruby")) # location of cmpi-bindings for Python @providers_dir = File.(File.join(TOPLEVEL,"..","..","build","swig","python")) end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
13 14 15 |
# File 'lib/provider-testing/pegasus.rb', line 13 def dir @dir end |
#pid ⇒ Object (readonly)
Returns the value of attribute pid.
13 14 15 |
# File 'lib/provider-testing/pegasus.rb', line 13 def pid @pid end |
#providers_dir ⇒ Object (readonly)
Returns the value of attribute providers_dir.
13 14 15 |
# File 'lib/provider-testing/pegasus.rb', line 13 def providers_dir @providers_dir end |
#registration_dir ⇒ Object (readonly)
Returns the value of attribute registration_dir.
13 14 15 |
# File 'lib/provider-testing/pegasus.rb', line 13 def registration_dir @registration_dir end |
#stage_dir ⇒ Object (readonly)
Returns the value of attribute stage_dir.
13 14 15 |
# File 'lib/provider-testing/pegasus.rb', line 13 def stage_dir @stage_dir end |
#uri ⇒ Object (readonly)
return uri to connect to
63 64 65 |
# File 'lib/provider-testing/pegasus.rb', line 63 def uri @uri end |
Instance Method Details
#mkcfg ⇒ Object
make Pegasus configuration
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/provider-testing/pegasus.rb', line 81 def mkcfg # trace_components = [ALL # AsyncOpNode # Authentication # Authorization # BinaryMessageHandler # Channel # CimData # CIMExportRequestDispatcher # CIMOMHandle # Config # ConfigurationManager # ControlProvider # CQL # DiscardedData # Dispatcher # ExportClient # Http # IndDelivery # IndicationHandlerService # IndicationService # IndicationServiceInternal # IndHandler # IPC # L10N # Listener # Memory # MessageQueueService # MetaDispatcher # ObjectResolution # OsAbstraction # ProviderAgent # ProviderManager # ProvManager # Registration # Repository # Server # Shutdown # SubscriptionService # Thread # UserManager # WQL # XmlIO # XmlParser # XmlReader # XmlWriter @config = { "daemon" => "false", "enableAuthentication" => "false", "enableHttpConnection" => "true", "enableHttpsConnection" => "false", "httpPort" => @port, "traceFilePath" => File.join(@dir, "trace.log"), "traceLevel" => 1, # 1,2,3,4 # "traceComponents" => "", # "logLevel" => "INFORMATION", # TRACE, INFORMATION, WARNING, SEVERE, FATAL. # "repositoryDir" => "/var/lib/Pegasus/repository", "providerDir" => "#{@providers_dir}:/usr/lib64/cmpi:/usr/lib/cmpi:/usr/lib64/pycim:/usr/lib/pycim:/usr/lib64/Pegasus/providers:/usr/lib/Pegasus/providers" } end |
#start ⇒ Object
start Pegasus
143 144 145 146 147 148 149 |
# File 'lib/provider-testing/pegasus.rb', line 143 def start unless system "sudo #{@execfile} --status" cmd = ["sudo", @execfile] + @config.collect{ |k,v| "#{k}=#{v}" } puts cmd.inspect system *cmd end end |
#stop ⇒ Object
stop Pegasus
152 153 154 |
# File 'lib/provider-testing/pegasus.rb', line 152 def stop system "sudo #{@execfile} -s" end |