Dev commited on 2018-06-19 06:15:32
Showing 1 changed files, with 3 additions and 3 deletions.
... | ... |
@@ -20,7 +20,7 @@ Things are dependent on order of execution; especially if a resource is created |
20 | 20 |
|
21 | 21 |
## Structure |
22 | 22 |
|
23 |
-The layout of the project is as simple as it can be. All objects are in `objects` folder, while all the functions that execute on those objects, or their collection are in respective file in `managers` folder. `task.rb` is the controller and also doubles up as configuration parser and validator via `whatchugot`, `parse_packages`, `parse_files` and `parse_services`. Config parsing can be moved to its own class, but it was left as it is for this task as I tend to go into a rabbit-hole... and I need to deliver a solution asap. |
|
23 |
+The layout of the project is as simple as it can be. All objects are in `objects` folder, while all the functions that execute on those objects, or their collection are in respective file in `managers` folder. `task.rb` is the controller. Configuration is parsed in `managers/rcm_config_manager.rb`. |
|
24 | 24 |
|
25 | 25 |
### Configration and resources |
26 | 26 |
|
... | ... |
@@ -32,7 +32,7 @@ All objects are under `objects` folder. `rcm_file`, `rcm_package` and `rcm_servi |
32 | 32 |
|
33 | 33 |
### Managers |
34 | 34 |
|
35 |
-All functions that can be performed on an object or their collection are held in `managers` folder. Some of the functions in respective classes can be moved to object itself... and this thought would buttress what I mentioned earlier about going into rabbit-hole :P. |
|
35 |
+All functions that can be performed on an object or their collection are held in `managers` folder. |
|
36 | 36 |
|
37 | 37 |
For file operations, I rely on `FileUtils` provided by ruby core, whereas I execute commands on systems for packages. Had I used Python, there was an API available to interact with package system. After all, apt is also a Python application. |
38 | 38 |
|
... | ... |
@@ -46,7 +46,7 @@ Config file is loaded at startup and various checks done to make sure configurat |
46 | 46 |
|
47 | 47 |
State is maintained in 2 objects: |
48 | 48 |
|
49 |
-1. `@wanted` holds the state as mentioned in `config.yaml` or `config_<env>.yaml`. It is populated in `parse_packages`, `parse_files` and `parse_services`. |
|
49 |
+1. `@wanted` holds the state as mentioned in `config.yaml` or `config_<env>.yaml`. It is populated in `::RCM::ConfigManager` during initialization. |
|
50 | 50 |
2. `@got` holds the state of resources currently present on the system. |
51 | 51 |
|
52 | 52 |
I first get `get_current_state` of packages and `converge_packages` because in current configuration, there is a file that appears only upon installation of `apache2` package. I then `get_current_state` of files and `converge_files`. Finally `restart_services_if_needed`. |
53 | 53 |