@@ -77,8 +77,7 @@ |
||
77 | 77 | |
78 | 78 | return $return; |
79 | 79 | } |
80 | - catch (Exception $e) |
|
81 | - { |
|
80 | + catch (Exception $e) { |
|
82 | 81 | throw new E5xx_ActionFailed(__METHOD__, $e->getMessage()); |
83 | 82 | } |
84 | 83 | } |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | $tables = $this->getAllTables(); |
75 | 75 | |
76 | 76 | // make sure it exists |
77 | - if (!isset($tables->$tableName)){ |
|
77 | + if (!isset($tables->$tableName)) { |
|
78 | 78 | $log->addStep("{$tableName} does not exist in the runtime config. creating empty table", function() use ($tables, $tableName){ |
79 | 79 | $tables->$tableName = new BaseObject(); |
80 | 80 | }); |
81 | 81 | } |
82 | 82 | |
83 | 83 | // make sure we don't have a duplicate entry |
84 | - if (isset($tables->$tableName->$key)){ |
|
84 | + if (isset($tables->$tableName->$key)) { |
|
85 | 85 | $msg = "Table already contains an entry for '{$key}'"; |
86 | 86 | $log->endAction($msg); |
87 | 87 | throw new E5xx_ActionFailed(__METHOD__, $msg); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | $tables = $this->getAllTables(); |
172 | 172 | |
173 | 173 | // make sure it exists |
174 | - if (!isset($tables->$tableName)){ |
|
174 | + if (!isset($tables->$tableName)) { |
|
175 | 175 | $tables->$tableName = new BaseObject(); |
176 | 176 | } |
177 | 177 | if (!isset($tables->$tableName->$group)) { |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | // make sure we don't have a duplicate entry |
182 | - if (isset($tables->$tableName->$group->$key)){ |
|
182 | + if (isset($tables->$tableName->$group->$key)) { |
|
183 | 183 | $msg = "table already contains an entry for '{$group}->{$key}'"; |
184 | 184 | $log->endAction($msg); |
185 | 185 | throw new E5xx_ActionFailed(__METHOD__, $msg); |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | $tables = $this->getAllTables(); |
75 | 75 | |
76 | 76 | // make sure it exists |
77 | - if (!isset($tables->$tableName)){ |
|
78 | - $log->addStep("{$tableName} does not exist in the runtime config. creating empty table", function() use ($tables, $tableName){ |
|
77 | + if (!isset($tables->$tableName)) { |
|
78 | + $log->addStep("{$tableName} does not exist in the runtime config. creating empty table", function() use ($tables, $tableName) { |
|
79 | 79 | $tables->$tableName = new BaseObject(); |
80 | 80 | }); |
81 | 81 | } |
82 | 82 | |
83 | 83 | // make sure we don't have a duplicate entry |
84 | - if (isset($tables->$tableName->$key)){ |
|
84 | + if (isset($tables->$tableName->$key)) { |
|
85 | 85 | $msg = "Table already contains an entry for '{$key}'"; |
86 | 86 | $log->endAction($msg); |
87 | 87 | throw new E5xx_ActionFailed(__METHOD__, $msg); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | $tables = $this->getAllTables(); |
212 | 212 | |
213 | 213 | // make sure it exists |
214 | - if (!isset($tables->$tableName)){ |
|
214 | + if (!isset($tables->$tableName)) { |
|
215 | 215 | $tables->$tableName = new BaseObject(); |
216 | 216 | } |
217 | 217 | if (!isset($tables->$tableName->$group)) { |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | } |
220 | 220 | |
221 | 221 | // make sure we don't have a duplicate entry |
222 | - if (isset($tables->$tableName->$group->$key)){ |
|
222 | + if (isset($tables->$tableName->$group->$key)) { |
|
223 | 223 | $msg = "table already contains an entry for '{$group}->{$key}'"; |
224 | 224 | $log->endAction($msg); |
225 | 225 | throw new E5xx_ActionFailed(__METHOD__, $msg); |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | |
286 | 286 | // remove the table if it's empty |
287 | 287 | if (!count(get_object_vars($tables->$tableName->$group))) { |
288 | - $log->addStep("table group '{$tableName}->{$group}' is empty, removing from runtime config", function() use ($tables, $tableName, $group){ |
|
288 | + $log->addStep("table group '{$tableName}->{$group}' is empty, removing from runtime config", function() use ($tables, $tableName, $group) { |
|
289 | 289 | unset($tables->$tableName->$group); |
290 | 290 | }); |
291 | 291 | } |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | |
336 | 336 | // remove the table if it's empty |
337 | 337 | if (!count(get_object_vars($tables->$tableName->$group))) { |
338 | - $log->addStep("table group '{$tableName}->{$group}' is empty, removing from runtime config", function() use ($tables, $tableName, $group){ |
|
338 | + $log->addStep("table group '{$tableName}->{$group}' is empty, removing from runtime config", function() use ($tables, $tableName, $group) { |
|
339 | 339 | unset($tables->$tableName->$group); |
340 | 340 | }); |
341 | 341 | } |
@@ -84,7 +84,7 @@ |
||
84 | 84 | "-o UserKnownHostsFile=/dev/null", |
85 | 85 | "-o LogLevel=quiet", |
86 | 86 | ]; |
87 | - $vmDetails->scpOptions = [ |
|
87 | + $vmDetails->scpOptions = [ |
|
88 | 88 | "-i '" . $vmDetails->sshKeyFile . "'", |
89 | 89 | "-o StrictHostKeyChecking=no", |
90 | 90 | ]; |
@@ -115,8 +115,7 @@ |
||
115 | 115 | getenv("HOME") . "/.vagrant.d/insecure_private_key" |
116 | 116 | ]; |
117 | 117 | |
118 | - foreach ($keyFilenames as $keyFilename) |
|
119 | - { |
|
118 | + foreach ($keyFilenames as $keyFilename) { |
|
120 | 119 | usingLog()->writeToLog("checking if {$keyFilename} exists"); |
121 | 120 | if (file_exists($keyFilename)) { |
122 | 121 | $log->endAction($keyFilename); |
@@ -60,7 +60,7 @@ |
||
60 | 60 | */ |
61 | 61 | class UsingZmq extends Prose |
62 | 62 | { |
63 | - protected $socketMap = array ( |
|
63 | + protected $socketMap = array( |
|
64 | 64 | ZMQ::SOCKET_PUB => "ZMQ::SOCKET_PUB", |
65 | 65 | ZMQ::SOCKET_SUB => "ZMQ::SOCKET_SUB", |
66 | 66 | ZMQ::SOCKET_REQ => "ZMQ::SOCKET_REQ", |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // where are we unbinding from? |
97 | 97 | $endpoints = fromZmqSocket($this->args[0])->getEndpoints(); |
98 | 98 | |
99 | - foreach($endpoints['bind'] as $address) { |
|
99 | + foreach ($endpoints['bind'] as $address) { |
|
100 | 100 | usingLog()->writeToLog("unbinding from {$address}"); |
101 | 101 | $this->args[0]->unbind($address); |
102 | 102 | } |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | // where are we disconnecting from? |
157 | 157 | $endpoints = fromZmqSocket($this->args[0])->getEndpoints(); |
158 | 158 | |
159 | - foreach($endpoints['connect'] as $address) { |
|
159 | + foreach ($endpoints['connect'] as $address) { |
|
160 | 160 | usingLog()->writeToLog("disconnecting from {$address}"); |
161 | 161 | $this->args[0]->disconnect($address); |
162 | 162 | } |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | protected $host; |
63 | 63 | protected $zk; |
64 | 64 | |
65 | - protected $default_acl = array( array( |
|
65 | + protected $default_acl = array(array( |
|
66 | 66 | "perms" => Zookeeper::PERM_ALL, |
67 | 67 | "scheme" => "world", |
68 | 68 | "id" => "anyone" |
@@ -117,10 +117,10 @@ discard block |
||
117 | 117 | } |
118 | 118 | |
119 | 119 | // drop the last part, as that is the key itself |
120 | - unset($parts[count($parts) -1]); |
|
120 | + unset($parts[count($parts) - 1]); |
|
121 | 121 | |
122 | 122 | // start with an empty path |
123 | - $path = ''; |
|
123 | + $path = ''; |
|
124 | 124 | |
125 | 125 | // work through the parts, building up the path to create from |
126 | 126 | // the root of the directory |
@@ -124,16 +124,14 @@ discard block |
||
124 | 124 | |
125 | 125 | // work through the parts, building up the path to create from |
126 | 126 | // the root of the directory |
127 | - foreach ($parts as $part) |
|
128 | - { |
|
127 | + foreach ($parts as $part) { |
|
129 | 128 | // expand our path to the next part |
130 | 129 | $path .= '/' . $part; |
131 | 130 | |
132 | 131 | // does this path exist? |
133 | 132 | if (!$this->zk->exists($path)) { |
134 | 133 | // no - create it |
135 | - if (!$this->zk->create($path, 1, $this->default_acl)) |
|
136 | - { |
|
134 | + if (!$this->zk->create($path, 1, $this->default_acl)) { |
|
137 | 135 | // failed to create the entry |
138 | 136 | throw new E5xx_ActionFailed(__METHOD__); |
139 | 137 | } |
@@ -151,8 +149,9 @@ discard block |
||
151 | 149 | |
152 | 150 | // now we can safely set the key itself |
153 | 151 | if (!$this->zk->exists($key)) { |
154 | - if (!$this->zk->create($key, $value, $this->default_acl)) |
|
155 | - throw new E5xx_ActionFailed(__METHOD__); |
|
152 | + if (!$this->zk->create($key, $value, $this->default_acl)) { |
|
153 | + throw new E5xx_ActionFailed(__METHOD__); |
|
154 | + } |
|
156 | 155 | } |
157 | 156 | else if (!$this->zk->set($key, $value)) { |
158 | 157 | throw new E5xx_ActionFailed(__METHOD__); |
@@ -1088,7 +1088,7 @@ |
||
1088 | 1088 | */ |
1089 | 1089 | function fromSupervisor($hostId) |
1090 | 1090 | { |
1091 | - return new FromSupervisor(StoryTeller::instance(),[$hostId]); |
|
1091 | + return new FromSupervisor(StoryTeller::instance(), [$hostId]); |
|
1092 | 1092 | } |
1093 | 1093 | |
1094 | 1094 | /** |
@@ -61,75 +61,75 @@ |
||
61 | 61 | |
62 | 62 | class Dsbuild_Adapter implements ProvisioningAdapter |
63 | 63 | { |
64 | - public function __construct() |
|
65 | - { |
|
66 | - $this->setExecutePath(getcwd() . DIRECTORY_SEPARATOR . "dsbuild.sh"); |
|
67 | - } |
|
68 | - |
|
69 | - // ================================================================== |
|
70 | - // |
|
71 | - // Support for executing the script |
|
72 | - // |
|
73 | - // ------------------------------------------------------------------ |
|
74 | - |
|
75 | - /** |
|
76 | - * where is the script that we are going to execute? |
|
77 | - * |
|
78 | - * @var string |
|
79 | - */ |
|
80 | - protected $executePath; |
|
81 | - |
|
82 | - /** |
|
83 | - * which folder are we executing things in? |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function getExecuteDir() |
|
88 | - { |
|
89 | - return dirname($this->executePath); |
|
90 | - } |
|
91 | - |
|
92 | - /** |
|
93 | - * where is the script that we are going to execute? |
|
94 | - * |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public function getExecutePath() |
|
98 | - { |
|
99 | - return $this->executePath; |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * tell me which script to execute |
|
104 | - * |
|
105 | - * @param string $path |
|
106 | - * path to the dsbuild script |
|
107 | - */ |
|
108 | - public function setExecutePath($path) |
|
109 | - { |
|
110 | - $this->executePath = $path; |
|
111 | - |
|
112 | - return $this; |
|
113 | - } |
|
114 | - |
|
115 | - // ================================================================== |
|
116 | - // |
|
117 | - // SPv2.0-style config support |
|
118 | - // |
|
119 | - // ------------------------------------------------------------------ |
|
120 | - |
|
121 | - public function getAsConfig() |
|
122 | - { |
|
123 | - // our return value |
|
124 | - $retval = new BaseObject; |
|
125 | - |
|
126 | - // this is who we are |
|
127 | - $retval->engine = "dsbuild"; |
|
128 | - |
|
129 | - // this is what needs running |
|
130 | - $retval->execute = $this->getExecutePath(); |
|
131 | - |
|
132 | - // all done |
|
133 | - return $retval; |
|
134 | - } |
|
64 | + public function __construct() |
|
65 | + { |
|
66 | + $this->setExecutePath(getcwd() . DIRECTORY_SEPARATOR . "dsbuild.sh"); |
|
67 | + } |
|
68 | + |
|
69 | + // ================================================================== |
|
70 | + // |
|
71 | + // Support for executing the script |
|
72 | + // |
|
73 | + // ------------------------------------------------------------------ |
|
74 | + |
|
75 | + /** |
|
76 | + * where is the script that we are going to execute? |
|
77 | + * |
|
78 | + * @var string |
|
79 | + */ |
|
80 | + protected $executePath; |
|
81 | + |
|
82 | + /** |
|
83 | + * which folder are we executing things in? |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function getExecuteDir() |
|
88 | + { |
|
89 | + return dirname($this->executePath); |
|
90 | + } |
|
91 | + |
|
92 | + /** |
|
93 | + * where is the script that we are going to execute? |
|
94 | + * |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public function getExecutePath() |
|
98 | + { |
|
99 | + return $this->executePath; |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * tell me which script to execute |
|
104 | + * |
|
105 | + * @param string $path |
|
106 | + * path to the dsbuild script |
|
107 | + */ |
|
108 | + public function setExecutePath($path) |
|
109 | + { |
|
110 | + $this->executePath = $path; |
|
111 | + |
|
112 | + return $this; |
|
113 | + } |
|
114 | + |
|
115 | + // ================================================================== |
|
116 | + // |
|
117 | + // SPv2.0-style config support |
|
118 | + // |
|
119 | + // ------------------------------------------------------------------ |
|
120 | + |
|
121 | + public function getAsConfig() |
|
122 | + { |
|
123 | + // our return value |
|
124 | + $retval = new BaseObject; |
|
125 | + |
|
126 | + // this is who we are |
|
127 | + $retval->engine = "dsbuild"; |
|
128 | + |
|
129 | + // this is what needs running |
|
130 | + $retval->execute = $this->getExecutePath(); |
|
131 | + |
|
132 | + // all done |
|
133 | + return $retval; |
|
134 | + } |
|
135 | 135 | } |
136 | 136 | \ No newline at end of file |
@@ -67,12 +67,12 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function getBaseFolder(); |
69 | 69 | |
70 | - /** |
|
71 | - * how do we validate any host adapters used by hosts in this group? |
|
72 | - * |
|
73 | - * @return HostAdapterValidator |
|
74 | - */ |
|
75 | - public function getHostAdapterValidator(); |
|
70 | + /** |
|
71 | + * how do we validate any host adapters used by hosts in this group? |
|
72 | + * |
|
73 | + * @return HostAdapterValidator |
|
74 | + */ |
|
75 | + public function getHostAdapterValidator(); |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * what type of group are we? |
@@ -82,5 +82,5 @@ discard block |
||
82 | 82 | * |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public function getType(); |
|
85 | + public function getType(); |
|
86 | 86 | } |
87 | 87 | \ No newline at end of file |