File: list_services.rb

package info (click to toggle)
ruby-fog-openstack 1.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,784 kB
  • sloc: ruby: 47,937; makefile: 5; sh: 4
file content (66 lines) | stat: -rw-r--r-- 2,620 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
module Fog
  module OpenStack
    class Compute
      class Real
        def list_services(parameters = nil)
          request(
            :expects => [200, 203],
            :method  => 'GET',
            :path    => 'os-services',
            :query   => parameters
          )
        end
      end

      class Mock
        def list_services(_parameters = nil)
          response = Excon::Response.new
          response.status = 200
          response.body = {
            "services" => [{
              "id"              => 1,
              "binary"          => "nova-scheduler",
              "host"            => "host1",
              "state"           => "up",
              "status"          => "disabled",
              "updated_at"      => "2012-10-29T13:42:02.000000",
              "zone"            => "internal",
              "disabled_reason" => "test2"
            },
                           {
                             "id"              => 2,
                             "binary"          => "nova-compute",
                             "host"            => "host1",
                             "state"           => "up",
                             "status"          => "disabled",
                             "updated_at"      => "2012-10-29T13:42:05.000000",
                             "zone"            => "nova",
                             "disabled_reason" => "test2"
                           },
                           {
                             "id"              => 3,
                             "binary"          => "nova-scheduler",
                             "host"            => "host2",
                             "state"           => "down",
                             "status"          => "enabled",
                             "updated_at"      => "2012-09-19T06:55:34.000000",
                             "zone"            => "internal",
                             "disabled_reason" => "nil"
                           },
                           {
                             "id"              => 4,
                             "binary"          => "nova-compute",
                             "host"            => "host2",
                             "state"           => "down",
                             "status"          => "disabled",
                             "updated_at"      => "2012-09-18T08:03:38.000000",
                             "zone"            => "nova",
                             "disabled_reason" => "test2"
                           }]
          }
          response
        end
      end
    end
  end
end