Popular New Releases in Configuration Management
consul
v1.12.0
viper
v1.11.0
eureka
v1.10.14
chezmoi
v2.15.1
cross-env
v7.0.3
Popular Libraries in Configuration Management
by mathiasbynens shell
26792 MIT
:wrench: .files, including ~/.macos — sensible hacker defaults for macOS
by hashicorp go
24633 MPL-2.0
Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.
by spf13 go
18971 MIT
Go configuration with fangs
by Netflix java
10478 Apache-2.0
AWS Service registry for resilient mid-tier load balancing and failover.
by kelseyhightower go
7475 MIT
Manage local application configuration files using templates and data from etcd or consul
by thoughtbot shell
6628 NOASSERTION
A set of vim, zsh, git, and tmux configuration files.
by twpayne go
6468 MIT
Manage your dotfiles across multiple diverse machines, securely.
by sebastianbergmann php
6243 NOASSERTION
Provides the functionality to compare PHP values for equality.
by holman shell
6224 MIT
@holman does dotfiles
Trending New libraries in Configuration Management
by owl4ce css
1488 GPL-3.0
:cherry_blossom: Aesthetic OpenboxWM Environment
by v2fly css
882
v2ray-core 的模板们
by Axarva shell
717 MIT
XMonad™️. Widgets go brr.
by spatie php
634 MIT
Store strongly typed application settings
by jszczerbinsky c
469 MIT
Visually customizable shell utils
by Kharacternyk python
460 GPL-3.0
What do people have in their dotfiles?
by jsiebens go
381 MIT
bootstrap HashiCorp Consul, Nomad, or Vault over SSH < 1 minute
by anmol098 javascript
332 MIT
This is my personal website here I keep updating changes which cannot be summed up in my Resume
by zkokaja swift
320 BSD-2-Clause
The missing menulet for brew.sh: keeping your packages up-to-date, and your system secure.
Top Authors in Configuration Management
1
90 Libraries
4114
2
66 Libraries
2789
3
54 Libraries
163
4
45 Libraries
123
5
41 Libraries
1695
6
29 Libraries
304
7
26 Libraries
154
8
24 Libraries
838
9
20 Libraries
580
10
19 Libraries
503
1
90 Libraries
4114
2
66 Libraries
2789
3
54 Libraries
163
4
45 Libraries
123
5
41 Libraries
1695
6
29 Libraries
304
7
26 Libraries
154
8
24 Libraries
838
9
20 Libraries
580
10
19 Libraries
503
Trending Kits in Configuration Management
No Trending Kits are available at this moment for Configuration Management
Trending Discussions on Configuration Management
Unable to save as word document in another location
Using Typer and Hydra together
how to stop letter repeating itself python
A paradox - putting my Ansible server under CM control?
WSO2-IS 5.11.0 - CORS management service error when intercepting an HTTP request - MySQL DB
How to query for VM compliance report in Google Cloud Logs Explorer
How to use Dynaconf to configure Celery
How to use static spring cloud stream url for launching spring cloud tasks?
Bind an array of .NET Core configuration sections to a class or List<class>
unable to uprade marklogic data hub framework using gradle
QUESTION
Unable to save as word document in another location
Asked 2022-Mar-09 at 08:271Public Sub WordFindAndReplace()
2 Dim wrdApp, wrdDoc
3 Dim ws As Worksheet, msWord As Object, itm As Range
4 Dim sFolder As String
5 Dim filename As String
6 Dim Path As String
7
8
9 Path = "C:\Rohan\Automations\CM Plan Automation\Upload\"
10 filename = Range("C4").Text
11 Set ws = ActiveSheet
12 Set msWord = CreateObject("Word.Application")
13
14 With msWord
15 .Visible = True
16 .documents.Open "C:\Rohan\Automations\CM Plan Automation\Engagement Name_Configuration Management Plan.docx"
17 .Activate
18
19 With .ActiveDocument.Content.Find
20 .ClearFormatting
21 .Replacement.ClearFormatting
22
23 For Each itm In ws.UsedRange.Columns("B").Cells
24
25 .Text = itm.Value2 'Find all strings in col A
26
27 .Replacement.Text = itm.Offset(, 1).Value2 'Replacements from col B
28
29 .MatchCase = False
30 .MatchWholeWord = False
31
32 .Execute Replace:=2 'wdReplaceAll (WdReplace Enumeration)
33 Next
34
35 End With
36
37
38 .SaveAs2 filename:=filename & _
39FileFormat:=wdFormatDocumentDefault, AddtoRecentFiles:=False
40
41 '.Quit SaveChanges:=True
42
43 '.Quit
44
45 '.SaveAs2 Filename:=("file name goes here"), _
46 FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False
47
48
49 '.SaveAs filename:=filename & ".docx"
50
51 '.SaveAs2 filename:="C:\Rohan\Automations\CM Plan Automation\Upload\" & ".docx",
52 'FileFormat:=wdFormatDocumentDefault
53
54
55
56 End With
57
58 MsgBox "Done"
59
60
61End Sub
62
ANSWER
Answered 2022-Mar-09 at 08:27The problem is that your SaveAs
code comes in the With msWord
block and is missing a document object.
Your issue is related to your use of late binding (declaring Word as object). There is little value to using late binding in this instance. Using it has meant that the compiler doesn't know your code is wrong. It has also robbed you of the use of IntelliSense and access to the Word object library in the Object Browser.
The only advantage to late binding is version independence, i.e. you can write code in a newer version, and it will theoretically work in an older one. But that advantage is lost unless you also use late binding for the host application code as Office is usually installed as a package. It is better to use early binding when working with other Office applications and reserve late binding for other commonly used libraries, e.g. ADO or XML.
Additionally, you should avoid the use of ActiveDocument
when your code is opening a specific document. Use a variable instead, as below.
1Public Sub WordFindAndReplace()
2 Dim wrdApp, wrdDoc
3 Dim ws As Worksheet, msWord As Object, itm As Range
4 Dim sFolder As String
5 Dim filename As String
6 Dim Path As String
7
8
9 Path = "C:\Rohan\Automations\CM Plan Automation\Upload\"
10 filename = Range("C4").Text
11 Set ws = ActiveSheet
12 Set msWord = CreateObject("Word.Application")
13
14 With msWord
15 .Visible = True
16 .documents.Open "C:\Rohan\Automations\CM Plan Automation\Engagement Name_Configuration Management Plan.docx"
17 .Activate
18
19 With .ActiveDocument.Content.Find
20 .ClearFormatting
21 .Replacement.ClearFormatting
22
23 For Each itm In ws.UsedRange.Columns("B").Cells
24
25 .Text = itm.Value2 'Find all strings in col A
26
27 .Replacement.Text = itm.Offset(, 1).Value2 'Replacements from col B
28
29 .MatchCase = False
30 .MatchWholeWord = False
31
32 .Execute Replace:=2 'wdReplaceAll (WdReplace Enumeration)
33 Next
34
35 End With
36
37
38 .SaveAs2 filename:=filename & _
39FileFormat:=wdFormatDocumentDefault, AddtoRecentFiles:=False
40
41 '.Quit SaveChanges:=True
42
43 '.Quit
44
45 '.SaveAs2 Filename:=("file name goes here"), _
46 FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False
47
48
49 '.SaveAs filename:=filename & ".docx"
50
51 '.SaveAs2 filename:="C:\Rohan\Automations\CM Plan Automation\Upload\" & ".docx",
52 'FileFormat:=wdFormatDocumentDefault
53
54
55
56 End With
57
58 MsgBox "Done"
59
60
61End Sub
62Public Sub WordFindAndReplace()
63 Dim msWord As Word.Application, wrdDoc As Word.Document
64 Dim ws As Worksheet, itm As Range
65 Dim sFolder As String
66 Dim filename As String
67 Dim Path As String
68
69
70 Path = "C:\Rohan\Automations\CM Plan Automation\Upload\"
71 filename = Range("C4").Text
72 Set ws = ActiveSheet
73 Set msWord = CreateObject("Word.Application")
74
75 With msWord
76 .Visible = True
77 Set wrdDoc = .documents.Open("C:\Rohan\Automations\CM Plan Automation\Engagement Name_Configuration Management Plan.docx")
78
79 With wrdDoc.Content.Find
80 .ClearFormatting
81 .Replacement.ClearFormatting
82 .MatchCase = False
83 .MatchWholeWord = False
84
85 For Each itm In ws.UsedRange.Columns("B").Cells
86
87 .Text = itm.Value2 'Find all strings in col A
88
89 .Replacement.Text = itm.Offset(, 1).Value2 'Replacements from col B
90
91 .Execute Replace:=2 'wdReplaceAll (WdReplace Enumeration)
92 Next
93
94 End With
95
96 wrdDoc.SaveAs2 filename:=filename, FileFormat:=wdFormatDocumentDefault, AddtoRecentFiles:=False
97
98 End With
99
100 MsgBox "Done"
101
102End Sub
103
QUESTION
Using Typer and Hydra together
Asked 2022-Jan-24 at 09:28I have a simple Typer application:
1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7 print("Hi")
8
9@app.callback()
10def main():
11 pass
12
13if __name__ == "__main__":
14 app()
15
I would like to use Hydra for the configuration management of the app, however I am not sure how to do that without losing the ability to override the config from the CLI.
My first attempt was:
1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7 print("Hi")
8
9@app.callback()
10def main():
11 pass
12
13if __name__ == "__main__":
14 app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23 print("Hi")
24
25@app.callback()
26@hydra.main(config_path="conf", config_name="config")
27def main(cfg: DictConfig) -> None:
28 print(OmegaConf.to_yaml(cfg))
29
30if __name__ == "__main__":
31 app()
32
But I get an error saying:
1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7 print("Hi")
8
9@app.callback()
10def main():
11 pass
12
13if __name__ == "__main__":
14 app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23 print("Hi")
24
25@app.callback()
26@hydra.main(config_path="conf", config_name="config")
27def main(cfg: DictConfig) -> None:
28 print(OmegaConf.to_yaml(cfg))
29
30if __name__ == "__main__":
31 app()
32RuntimeError: Type not yet supported: <class 'omegaconf.dictconfig.DictConfig'>
33
If I remove the DictConfig
type annotation I get an error that cfg
is missing.
I saw in Hydra docs the Compose API that allows to initialize the config without decorators:
1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7 print("Hi")
8
9@app.callback()
10def main():
11 pass
12
13if __name__ == "__main__":
14 app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23 print("Hi")
24
25@app.callback()
26@hydra.main(config_path="conf", config_name="config")
27def main(cfg: DictConfig) -> None:
28 print(OmegaConf.to_yaml(cfg))
29
30if __name__ == "__main__":
31 app()
32RuntimeError: Type not yet supported: <class 'omegaconf.dictconfig.DictConfig'>
33@app.callback()
34def main() -> None:
35 with initialize(config_path="conf", job_name="test_app"):
36 cfg = compose(config_name="config")
37 print(OmegaConf.to_yaml(cfg))
38
but It seems that I can't override config from the command line in this case as those values are not recognized by the Typer app.
Any recommendations how it can be resolved?
ANSWER
Answered 2022-Jan-24 at 09:28The compose
function accepts an optional list of override strings:
1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7 print("Hi")
8
9@app.callback()
10def main():
11 pass
12
13if __name__ == "__main__":
14 app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23 print("Hi")
24
25@app.callback()
26@hydra.main(config_path="conf", config_name="config")
27def main(cfg: DictConfig) -> None:
28 print(OmegaConf.to_yaml(cfg))
29
30if __name__ == "__main__":
31 app()
32RuntimeError: Type not yet supported: <class 'omegaconf.dictconfig.DictConfig'>
33@app.callback()
34def main() -> None:
35 with initialize(config_path="conf", job_name="test_app"):
36 cfg = compose(config_name="config")
37 print(OmegaConf.to_yaml(cfg))
38with initialize(config_path="conf", job_name="test_app"):
39 cfg = compose(config_name="config", overrides=["db=mysql", "db.user=me"])
40
You will need to get a list of override strings from the command line, then pass that list to compose
.
Here is an example using Typer; similar patterns could work for e.g. argparse or click.
(Disclaimer: I am not a Typer expert)
1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7 print("Hi")
8
9@app.callback()
10def main():
11 pass
12
13if __name__ == "__main__":
14 app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23 print("Hi")
24
25@app.callback()
26@hydra.main(config_path="conf", config_name="config")
27def main(cfg: DictConfig) -> None:
28 print(OmegaConf.to_yaml(cfg))
29
30if __name__ == "__main__":
31 app()
32RuntimeError: Type not yet supported: <class 'omegaconf.dictconfig.DictConfig'>
33@app.callback()
34def main() -> None:
35 with initialize(config_path="conf", job_name="test_app"):
36 cfg = compose(config_name="config")
37 print(OmegaConf.to_yaml(cfg))
38with initialize(config_path="conf", job_name="test_app"):
39 cfg = compose(config_name="config", overrides=["db=mysql", "db.user=me"])
40from typing import List, Optional
41
42import typer
43from omegaconf import OmegaConf, DictConfig
44
45from hydra import compose, initialize
46
47app = typer.Typer()
48
49def my_compose(overrides: Optional[List[str]]) -> DictConfig:
50 with initialize(config_path="conf", job_name="test_app"):
51 return compose(config_name="config", overrides=overrides)
52
53@app.command()
54def say_hi(overrides: Optional[List[str]] = typer.Argument(None)):
55 print("HI!")
56 print(f"Got {overrides=}")
57 cfg = my_compose(overrides)
58 print("\nHydra config:")
59 print(OmegaConf.to_yaml(cfg))
60
61@app.command()
62def say_bye(overrides: Optional[List[str]] = typer.Argument(None)):
63 cfg = my_compose(overrides)
64 ...
65 print("BYE!")
66
67if __name__ == "__main__":
68 app()
69
1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7 print("Hi")
8
9@app.callback()
10def main():
11 pass
12
13if __name__ == "__main__":
14 app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23 print("Hi")
24
25@app.callback()
26@hydra.main(config_path="conf", config_name="config")
27def main(cfg: DictConfig) -> None:
28 print(OmegaConf.to_yaml(cfg))
29
30if __name__ == "__main__":
31 app()
32RuntimeError: Type not yet supported: <class 'omegaconf.dictconfig.DictConfig'>
33@app.callback()
34def main() -> None:
35 with initialize(config_path="conf", job_name="test_app"):
36 cfg = compose(config_name="config")
37 print(OmegaConf.to_yaml(cfg))
38with initialize(config_path="conf", job_name="test_app"):
39 cfg = compose(config_name="config", overrides=["db=mysql", "db.user=me"])
40from typing import List, Optional
41
42import typer
43from omegaconf import OmegaConf, DictConfig
44
45from hydra import compose, initialize
46
47app = typer.Typer()
48
49def my_compose(overrides: Optional[List[str]]) -> DictConfig:
50 with initialize(config_path="conf", job_name="test_app"):
51 return compose(config_name="config", overrides=overrides)
52
53@app.command()
54def say_hi(overrides: Optional[List[str]] = typer.Argument(None)):
55 print("HI!")
56 print(f"Got {overrides=}")
57 cfg = my_compose(overrides)
58 print("\nHydra config:")
59 print(OmegaConf.to_yaml(cfg))
60
61@app.command()
62def say_bye(overrides: Optional[List[str]] = typer.Argument(None)):
63 cfg = my_compose(overrides)
64 ...
65 print("BYE!")
66
67if __name__ == "__main__":
68 app()
69$ python my_app.py say-hi +foo=bar +baz=qux
70HI!
71Got overrides=('+foo=bar', '+baz=qux')
72
73Hydra config:
74foo: bar
75baz: qux
76
77$ python my_app.py say-bye
78BYE!
79
QUESTION
how to stop letter repeating itself python
Asked 2021-Nov-25 at 18:33I am making a code which takes in jumble word and returns a unjumbled word , the data.json contains a list and here take a word one-by-one and check if it contains all the characters of the word and later checking if the length is same , but the problem is when i enter a word as helol then the l is checked twice and giving me some other outputs including the main one(hello). i know why does it happen but i cant get a fix to it
1import json
2
3val = open("data.json")
4val1 = json.load(val)#loads the list
5
6
7a = input("Enter a Jumbled word ")#takes a word from user
8a = list(a)#changes into list to iterate
9
10
11for x in val1:#iterates words from list
12 for somethin in a:#iterates letters from list
13 if somethin in list(x):#checks if the letter is in the iterated word
14 continue
15 else:
16 break
17 else:#checks if the loop ended correctly (that means word has same letters)
18 if len(a) != len(list(x)):#checks if it has same number of letters
19 continue#returns
20 else:
21 print(x)#continues the loop to see if there are more like that
22
EDIT: many people wanted the json file so here it is
1import json
2
3val = open("data.json")
4val1 = json.load(val)#loads the list
5
6
7a = input("Enter a Jumbled word ")#takes a word from user
8a = list(a)#changes into list to iterate
9
10
11for x in val1:#iterates words from list
12 for somethin in a:#iterates letters from list
13 if somethin in list(x):#checks if the letter is in the iterated word
14 continue
15 else:
16 break
17 else:#checks if the loop ended correctly (that means word has same letters)
18 if len(a) != len(list(x)):#checks if it has same number of letters
19 continue#returns
20 else:
21 print(x)#continues the loop to see if there are more like that
22['Torres Strait Creole', 'good bye', 'agon', "queen's guard", 'animosity', 'price list', 'subjective', 'means', 'severe', 'knockout', 'life-threatening', 'entry into the war', 'dominion', 'damnify', 'packsaddle', 'hallucinate', 'lumpy', 'inception', 'Blankenese', 'cacophonous', 'zeptomole', 'floccinaucinihilipilificate', 'abashed', 'abacterial', 'ableism', 'invade', 'cohabitant', 'handicapped', 'obelus', 'triathlon', 'habitue', 'instigate', 'Gladstone Gander', 'Linked Data', 'seeded player', 'mozzarella', 'gymnast', 'gravitational force', 'Friedelehe', 'open up', 'bundt cake', 'riffraff', 'resourceful', 'wheedle', 'city center', 'gorgonzola', 'oaf', 'auf', 'oafs', 'galoot', 'imbecile', 'lout', 'moron', 'news leak', 'crate', 'aggregator', 'cheating', 'negative growth', 'zero growth', 'defer', 'ride back', 'drive back', 'start back', 'shy back', 'spring back', 'shrink back', 'shy away', 'abderian', 'unable', 'font manager', 'font management software', 'consortium', 'gown', 'inject', 'ISO 639', 'look up', 'cross-eyed', 'squinting', 'health club', 'fitness facility', 'steer', 'sunbathe', 'combatives', 'HTH', 'hope that helps', 'How The Hell', 'distributed', 'plum cake', 'liberalization', 'macchiato', 'caffè macchiato', 'beach volley', 'exult', 'jubilate', 'beach volleyball', 'be beached', 'affogato', 'gigabyte', 'terabyte', 'petabyte', 'undressed', 'decameter', 'sensual', 'boundary marker', 'poor man', 'cohabitee', 'night sleep', 'protruding ears', 'three quarters of an hour', 'spermophilus', 'spermophilus stricto sensu', "devil's advocate", 'sacred king', 'sacral king', 'myr', 'million years', 'obtuse-angled', 'inconsolable', 'neurotic', 'humiliating', 'mortifying', 'theological', 'rematch', 'varıety', 'be short', 'ontological', 'taxonomic', 'taxonomical', 'toxicology testing', 'on the job training', 'boulder', 'unattackable', 'inviolable', 'resinous', 'resiny', 'ionizing radiation', 'citrus grove', 'comic book shop', 'preparatory measure', 'written account', 'brittle', 'locker', 'baozi', 'bao', 'bau', 'humbow', 'nunu', 'bausak', 'pow', 'pau', 'yesteryear', 'fire drill', 'rotted', 'putto', 'overthrow', 'ankle monitor', 'somewhat stupid', 'a little stupid', 'semordnilap', 'pangram', 'emordnilap', 'person with a sunlamp tan', 'tittle', 'incompatible', 'autumn wind', 'dairyman', 'chesty', 'lacustrine', 'chronophotograph', 'chronophoto', 'leg lace', 'ankle lace', 'ankle lock', 'Babelfy', 'ventricular', 'recurrent', 'long-lasting', 'long-standing', 'long standing', 'sea bass', 'reap', 'break wind', 'chase away', 'spark', 'speckle', 'take back', 'Westphalian', 'Aeolic Greek', 'startup', 'abseiling', 'impure', 'bottle cork', 'paralympic', 'work out', 'might', 'ice-cream man', 'ice cream man', 'ice cream maker', 'ice-cream maker', 'traveling', 'special delivery', 'prizefighter', 'abs', 'ab', 'churro', 'pilfer', 'dehumanize', 'fertilize', 'inseminate', 'digitalize', 'fluke', 'stroke of luck', 'decontaminate', 'abandonware', 'manzanita', 'tule', 'jackrabbit', 'system administrator', 'system admin', 'springtime lethargy', 'Palatinean', 'organized religion', 'bearing puller', 'wheel puller', 'gear puller', 'shot', 'normalize', 'palindromic', 'lancet window', 'terminological', 'back of head', 'dragon food', 'barbel', 'Central American Spanish', 'basis', 'birthmark', 'blood vessel', 'ribes', 'dog-rose', 'dreadful', 'freckle', 'free of charge', 'weather verb', 'weather sentence', 'gipsy', 'gypsy', 'glutton', 'hump', 'low voice', 'meek', 'moist', 'river mouth', 'turbid', 'multitude', 'palate', 'peak of mountain', 'poetry', 'pure', 'scanty', 'spicy', 'spicey', 'spruce', 'surface', 'infected', 'copulate', 'dilute', 'dislocate', 'grow up', 'hew', 'hinder', 'infringe', 'inhabit', 'marry off', 'offend', 'pass by', 'brother of a man', 'brother of a woman', 'sister of a man', 'sister of a woman', 'agricultural farm', 'result in', 'rebel', 'strew', 'scatter', 'sway', 'tread', 'tremble', 'hog', 'circuit breaker', 'Southern Quechua', 'safety pin', 'baby pin', 'college student', 'university student', 'pinus sibirica', 'Siberian pine', 'have lunch', 'floppy', 'slack', 'sloppy', 'wishi-washi', 'turn around', 'bogeyman', 'selfish', 'Talossan', 'biomembrane', 'biological membrane', 'self-sufficiency', 'underevaluation', 'underestimation', 'opisthenar', 'prosody', 'Kumhar Bhag Paharia', 'psychoneurotic', 'psychoneurosis', 'levant', "couldn't-care-less attitude", 'noctambule', 'acid-free paper', 'decontaminant', 'woven', 'wheaten', 'waste-ridden', 'war-ridden', 'violence-ridden', 'unwritten', 'typewritten', 'spoken', 'abiogenetically', 'rasp', 'abstractly', 'cyclically', 'acyclically', 'acyclic', 'ad hoc', 'spare tire', 'spare wheel', 'spare tyre', 'prefabricated', 'ISO 9000', 'Barquisimeto', 'Maracay', 'Ciudad Guayana', 'San Cristobal', 'Barranquilla', 'Arequipa', 'Trujillo', 'Cusco', 'Callao', 'Cochabamba', 'Goiânia', 'Campinas', 'Fortaleza', 'Florianópolis', 'Rosario', 'Mendoza', 'Bariloche', 'temporality', 'papyrus sedge', 'paper reed', 'Indian matting plant', 'Nile grass', 'softly softly', 'abductive reasoning', 'abductive inference', 'retroduction', 'Salzburgian', 'cymotrichous', 'access point', 'wireless access point', 'dynamic DNS', 'IP address', 'electrolyte', 'helical', 'hydrometer', 'intranet', 'jumper', 'MAC address', 'Media Access Control address', 'nickel–cadmium battery', 'Ni-Cd battery', 'oscillograph', 'overload', 'photovoltaic', 'photovoltaic cell', 'refractor telescope', 'autosome', 'bacterial artificial chromosome', 'plasmid', 'nucleobase', 'base pair', 'base sequence', 'chromosomal deletion', 'deletion', 'deletion mutation', 'gene deletion', 'chromosomal inversion', 'comparative genomics', 'genomics', 'cytogenetics', 'DNA replication', 'DNA repair', 'DNA sequence', 'electrophoresis', 'functional genomics', 'retroviral', 'retroviral infection', 'acceptance criteria', 'batch processing', 'business rule', 'code review', 'configuration management', 'entity–relationship model', 'lifecycle', 'object code', 'prototyping', 'pseudocode', 'referential', 'reusability', 'self-join', 'timestamp', 'accredited', 'accredited translator', 'certify', 'certified translation', 'computer-aided design', 'computer-aided', 'computer-assisted', 'management system', 'computer-aided translation', 'computer-assisted translation', 'machine-aided translation', 'conference interpreter', 'freelance translator', 'literal translation', 'mother-tongue', 'whispered interpreting', 'simultaneous interpreting', 'simultaneous interpretation', 'base anhydride', 'binary compound', 'absorber', 'absorption coefficient', 'attenuation coefficient', 'active solar heater', 'ampacity', 'amorphous semiconductor', 'amorphous silicon', 'flowerpot', 'antireflection coating', 'antireflection', 'armored cable', 'electric arc', 'breakdown voltage','casing', 'facing', 'lining', 'assumption of Mary', 'auscultation']
23
Just a example and the dictionary is full of items
ANSWER
Answered 2021-Nov-25 at 18:33As I understand it you are trying to identify all possible matches for the jumbled string in your list. You could sort the letters in the jumbled word and match the resulting list against sorted lists of the words in your data file.
1import json
2
3val = open("data.json")
4val1 = json.load(val)#loads the list
5
6
7a = input("Enter a Jumbled word ")#takes a word from user
8a = list(a)#changes into list to iterate
9
10
11for x in val1:#iterates words from list
12 for somethin in a:#iterates letters from list
13 if somethin in list(x):#checks if the letter is in the iterated word
14 continue
15 else:
16 break
17 else:#checks if the loop ended correctly (that means word has same letters)
18 if len(a) != len(list(x)):#checks if it has same number of letters
19 continue#returns
20 else:
21 print(x)#continues the loop to see if there are more like that
22['Torres Strait Creole', 'good bye', 'agon', "queen's guard", 'animosity', 'price list', 'subjective', 'means', 'severe', 'knockout', 'life-threatening', 'entry into the war', 'dominion', 'damnify', 'packsaddle', 'hallucinate', 'lumpy', 'inception', 'Blankenese', 'cacophonous', 'zeptomole', 'floccinaucinihilipilificate', 'abashed', 'abacterial', 'ableism', 'invade', 'cohabitant', 'handicapped', 'obelus', 'triathlon', 'habitue', 'instigate', 'Gladstone Gander', 'Linked Data', 'seeded player', 'mozzarella', 'gymnast', 'gravitational force', 'Friedelehe', 'open up', 'bundt cake', 'riffraff', 'resourceful', 'wheedle', 'city center', 'gorgonzola', 'oaf', 'auf', 'oafs', 'galoot', 'imbecile', 'lout', 'moron', 'news leak', 'crate', 'aggregator', 'cheating', 'negative growth', 'zero growth', 'defer', 'ride back', 'drive back', 'start back', 'shy back', 'spring back', 'shrink back', 'shy away', 'abderian', 'unable', 'font manager', 'font management software', 'consortium', 'gown', 'inject', 'ISO 639', 'look up', 'cross-eyed', 'squinting', 'health club', 'fitness facility', 'steer', 'sunbathe', 'combatives', 'HTH', 'hope that helps', 'How The Hell', 'distributed', 'plum cake', 'liberalization', 'macchiato', 'caffè macchiato', 'beach volley', 'exult', 'jubilate', 'beach volleyball', 'be beached', 'affogato', 'gigabyte', 'terabyte', 'petabyte', 'undressed', 'decameter', 'sensual', 'boundary marker', 'poor man', 'cohabitee', 'night sleep', 'protruding ears', 'three quarters of an hour', 'spermophilus', 'spermophilus stricto sensu', "devil's advocate", 'sacred king', 'sacral king', 'myr', 'million years', 'obtuse-angled', 'inconsolable', 'neurotic', 'humiliating', 'mortifying', 'theological', 'rematch', 'varıety', 'be short', 'ontological', 'taxonomic', 'taxonomical', 'toxicology testing', 'on the job training', 'boulder', 'unattackable', 'inviolable', 'resinous', 'resiny', 'ionizing radiation', 'citrus grove', 'comic book shop', 'preparatory measure', 'written account', 'brittle', 'locker', 'baozi', 'bao', 'bau', 'humbow', 'nunu', 'bausak', 'pow', 'pau', 'yesteryear', 'fire drill', 'rotted', 'putto', 'overthrow', 'ankle monitor', 'somewhat stupid', 'a little stupid', 'semordnilap', 'pangram', 'emordnilap', 'person with a sunlamp tan', 'tittle', 'incompatible', 'autumn wind', 'dairyman', 'chesty', 'lacustrine', 'chronophotograph', 'chronophoto', 'leg lace', 'ankle lace', 'ankle lock', 'Babelfy', 'ventricular', 'recurrent', 'long-lasting', 'long-standing', 'long standing', 'sea bass', 'reap', 'break wind', 'chase away', 'spark', 'speckle', 'take back', 'Westphalian', 'Aeolic Greek', 'startup', 'abseiling', 'impure', 'bottle cork', 'paralympic', 'work out', 'might', 'ice-cream man', 'ice cream man', 'ice cream maker', 'ice-cream maker', 'traveling', 'special delivery', 'prizefighter', 'abs', 'ab', 'churro', 'pilfer', 'dehumanize', 'fertilize', 'inseminate', 'digitalize', 'fluke', 'stroke of luck', 'decontaminate', 'abandonware', 'manzanita', 'tule', 'jackrabbit', 'system administrator', 'system admin', 'springtime lethargy', 'Palatinean', 'organized religion', 'bearing puller', 'wheel puller', 'gear puller', 'shot', 'normalize', 'palindromic', 'lancet window', 'terminological', 'back of head', 'dragon food', 'barbel', 'Central American Spanish', 'basis', 'birthmark', 'blood vessel', 'ribes', 'dog-rose', 'dreadful', 'freckle', 'free of charge', 'weather verb', 'weather sentence', 'gipsy', 'gypsy', 'glutton', 'hump', 'low voice', 'meek', 'moist', 'river mouth', 'turbid', 'multitude', 'palate', 'peak of mountain', 'poetry', 'pure', 'scanty', 'spicy', 'spicey', 'spruce', 'surface', 'infected', 'copulate', 'dilute', 'dislocate', 'grow up', 'hew', 'hinder', 'infringe', 'inhabit', 'marry off', 'offend', 'pass by', 'brother of a man', 'brother of a woman', 'sister of a man', 'sister of a woman', 'agricultural farm', 'result in', 'rebel', 'strew', 'scatter', 'sway', 'tread', 'tremble', 'hog', 'circuit breaker', 'Southern Quechua', 'safety pin', 'baby pin', 'college student', 'university student', 'pinus sibirica', 'Siberian pine', 'have lunch', 'floppy', 'slack', 'sloppy', 'wishi-washi', 'turn around', 'bogeyman', 'selfish', 'Talossan', 'biomembrane', 'biological membrane', 'self-sufficiency', 'underevaluation', 'underestimation', 'opisthenar', 'prosody', 'Kumhar Bhag Paharia', 'psychoneurotic', 'psychoneurosis', 'levant', "couldn't-care-less attitude", 'noctambule', 'acid-free paper', 'decontaminant', 'woven', 'wheaten', 'waste-ridden', 'war-ridden', 'violence-ridden', 'unwritten', 'typewritten', 'spoken', 'abiogenetically', 'rasp', 'abstractly', 'cyclically', 'acyclically', 'acyclic', 'ad hoc', 'spare tire', 'spare wheel', 'spare tyre', 'prefabricated', 'ISO 9000', 'Barquisimeto', 'Maracay', 'Ciudad Guayana', 'San Cristobal', 'Barranquilla', 'Arequipa', 'Trujillo', 'Cusco', 'Callao', 'Cochabamba', 'Goiânia', 'Campinas', 'Fortaleza', 'Florianópolis', 'Rosario', 'Mendoza', 'Bariloche', 'temporality', 'papyrus sedge', 'paper reed', 'Indian matting plant', 'Nile grass', 'softly softly', 'abductive reasoning', 'abductive inference', 'retroduction', 'Salzburgian', 'cymotrichous', 'access point', 'wireless access point', 'dynamic DNS', 'IP address', 'electrolyte', 'helical', 'hydrometer', 'intranet', 'jumper', 'MAC address', 'Media Access Control address', 'nickel–cadmium battery', 'Ni-Cd battery', 'oscillograph', 'overload', 'photovoltaic', 'photovoltaic cell', 'refractor telescope', 'autosome', 'bacterial artificial chromosome', 'plasmid', 'nucleobase', 'base pair', 'base sequence', 'chromosomal deletion', 'deletion', 'deletion mutation', 'gene deletion', 'chromosomal inversion', 'comparative genomics', 'genomics', 'cytogenetics', 'DNA replication', 'DNA repair', 'DNA sequence', 'electrophoresis', 'functional genomics', 'retroviral', 'retroviral infection', 'acceptance criteria', 'batch processing', 'business rule', 'code review', 'configuration management', 'entity–relationship model', 'lifecycle', 'object code', 'prototyping', 'pseudocode', 'referential', 'reusability', 'self-join', 'timestamp', 'accredited', 'accredited translator', 'certify', 'certified translation', 'computer-aided design', 'computer-aided', 'computer-assisted', 'management system', 'computer-aided translation', 'computer-assisted translation', 'machine-aided translation', 'conference interpreter', 'freelance translator', 'literal translation', 'mother-tongue', 'whispered interpreting', 'simultaneous interpreting', 'simultaneous interpretation', 'base anhydride', 'binary compound', 'absorber', 'absorption coefficient', 'attenuation coefficient', 'active solar heater', 'ampacity', 'amorphous semiconductor', 'amorphous silicon', 'flowerpot', 'antireflection coating', 'antireflection', 'armored cable', 'electric arc', 'breakdown voltage','casing', 'facing', 'lining', 'assumption of Mary', 'auscultation']
23sorted_jumbled_word = sorted(a)
24for word in val1:
25 if len(sorted_jumbled_word) == len(word) and sorted(word) == sorted_jumbled_word:
26 print(word)
27
Checking by length first reduces unnecessary sorting. If doing this repeatedly, you might want to create a dictionary of the words in the data file with their sorted versions, to avoid having to repeatedly sort them.
There are spaces and punctuation in some of the terms in your word list. If you want to make the comparison ignoring spaces then remove them from both the jumbled word and the list of unjumbled words, using e.g. word = word.replace(" ", "")
QUESTION
A paradox - putting my Ansible server under CM control?
Asked 2021-Nov-15 at 12:08I'm starting to learn about DevOps and configuration management (CM). I am setting up my home network of RasPi 4B devices, and I intend to configure them using Ansible, following this guide on opensource.com. What I don't get though, is how I can possibly set up my Ansible host / server itself using CM as well? Presumably, the host can't update the client if the client is the host itself!
The guide I pointed to above implies that I should install Ansible on a laptop or PC. That sounds great, but in the longer-term, I eventually want all of my home network devices to come under CM control, including the RasPi's, laptops & PC's, and even our Android phones. This suggests to me that the solution is a dedicated Ansible host, running on a separate RasPi.
The paradox is, how do I get that host machine also to be under CM control, as well? 🤯
ANSWER
Answered 2021-Nov-15 at 12:08It's perfectly fine to use Ansible to configure controller. All you have to do is put a host in inventory with ansible_connection: local
variable. There are few modules which are not working for localhost, though: reboot
, wait_for_connection
, etc.
Actually, many people uses Ansible to configure their own linux laptops.
QUESTION
WSO2-IS 5.11.0 - CORS management service error when intercepting an HTTP request - MySQL DB
Asked 2021-Aug-29 at 20:22I'm trying to access carbon's login page of WSO2 Identity Server and I'm receiving an error when I change the default database in deployment.toml. If I use h2 internal database everything works, but if I change to use a mysql database running on a docker environment it gives an error.
This works:
1[database.identity_db]
2type = "h2"
3url = "jdbc:h2:./repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000"
4username = "wso2carbon"
5password = "wso2carbon"
6
This doesn't work
1[database.identity_db]
2type = "h2"
3url = "jdbc:h2:./repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000"
4username = "wso2carbon"
5password = "wso2carbon"
6[database.identity_db]
7type = "mysql"
8url = "jdbc:mysql://csm-wso2-mysqldb:3306/WSO2_IDENTITY_DB?autoReconnect=true&amp;useSSL=false"
9username = "regadmin"
10password = "regadmin"
11driver = "com.mysql.cj.jdbc.Driver"
12
csm-wso2-mysqldb is a docker container name
Error:
1[database.identity_db]
2type = "h2"
3url = "jdbc:h2:./repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000"
4username = "wso2carbon"
5password = "wso2carbon"
6[database.identity_db]
7type = "mysql"
8url = "jdbc:mysql://csm-wso2-mysqldb:3306/WSO2_IDENTITY_DB?autoReconnect=true&amp;useSSL=false"
9username = "regadmin"
10password = "regadmin"
11driver = "com.mysql.cj.jdbc.Driver"
12csm-wso2-is | [2021-08-28 17:54:15,197] [1deadc88-3363-427e-b238-89a418231406] ERROR {org.wso2.carbon.identity.cors.valve.CORSValve} -
13CORS management service error when intercepting an HTTP request. org.wso2.carbon.identity.cors.mgt.core.exception.CORSManagementServiceServerException: CMS-65006
14csm-wso2-is | at org.wso2.carbon.identity.cors.service.internal.impl.CORSManagerImpl.getCORSConfiguration(CORSManagerImpl.java:101)
15csm-wso2-is | at org.wso2.carbon.identity.cors.valve.CORSValve.invoke(CORSValve.java:81)
16csm-wso2-is | at org.wso2.carbon.identity.authz.valve.AuthorizationValve.invoke(AuthorizationValve.java:110)
17csm-wso2-is | at org.wso2.carbon.identity.auth.valve.AuthenticationValve.invoke(AuthenticationValve.java:102)
18csm-wso2-is | at org.wso2.carbon.tomcat.ext.valves.CompositeValve.continueInvocation(CompositeValve.java:99)
19csm-wso2-is | at org.wso2.carbon.tomcat.ext.valves.TomcatValveContainer.invokeValves(TomcatValveContainer.java:49)
20csm-wso2-is | at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:62)
21csm-wso2-is | at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:145)
22csm-wso2-is | at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)
23csm-wso2-is | at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:57)
24csm-wso2-is | at org.wso2.carbon.tomcat.ext.valves.RequestEncodingValve.invoke(RequestEncodingValve.java:49)
25csm-wso2-is | at org.wso2.carbon.tomcat.ext.valves.RequestCorrelationIdValve.invoke(RequestCorrelationIdValve.java:126)
26csm-wso2-is | at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
27csm-wso2-is | at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
28csm-wso2-is | at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:373)
29csm-wso2-is | at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)
30csm-wso2-is | at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:868)
31csm-wso2-is | at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1590)
32csm-wso2-is | at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
33csm-wso2-is | at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
34csm-wso2-is | at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
35csm-wso2-is | at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
36csm-wso2-is | at java.base/java.lang.Thread.run(Thread.java:834)
37csm-wso2-is | Caused by: org.wso2.carbon.identity.cors.mgt.core.exception.CORSManagementServiceServerException: CMS-65006
38csm-wso2-is | at org.wso2.carbon.identity.cors.mgt.core.internal.util.ErrorUtils.handleServerException(ErrorUtils.java:56)
39csm-wso2-is | at org.wso2.carbon.identity.cors.mgt.core.dao.impl.CORSConfigurationDAOImpl.getCORSConfigurationByTenantDomain(CORSConfigurationDAOImpl.java:76)
40csm-wso2-is | at org.wso2.carbon.identity.cors.service.internal.impl.CORSManagerImpl.getCORSConfiguration(CORSManagerImpl.java:93)
41csm-wso2-is | ... 22 more
42csm-wso2-is | Caused by: org.wso2.carbon.identity.configuration.mgt.core.exception.ConfigurationManagementClientException: Configuration management feature is not enabled.
43csm-wso2-is | at org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManagerImpl.checkFeatureStatus(ConfigurationManagerImpl.java:809)
44csm-wso2-is | at org.wso2.carbon.identity.configuration.mgt.core.ConfigurationManagerImpl.getResource(ConfigurationManagerImpl.java:194)
45csm-wso2-is | at org.wso2.carbon.identity.cors.mgt.core.dao.impl.CORSConfigurationDAOImpl.getResource(CORSConfigurationDAOImpl.java:123)
46csm-wso2-is | at org.wso2.carbon.identity.cors.mgt.core.dao.impl.CORSConfigurationDAOImpl.getCORSConfigurationByTenantDomain(CORSConfigurationDAOImpl.java:67)
47
What Am I doing wrong? I've checked if the table and user exist.
ANSWER
Answered 2021-Aug-29 at 20:22I was using db scripts from an older version. WSO2-IS 5.11.0 needs IDN_CONFIG_TYPE, IDN_CONFIG_RESOURCE, IDN_CONFIG_ATTRIBUTE and IDN_CONFIG_FILE tables.
QUESTION
How to query for VM compliance report in Google Cloud Logs Explorer
Asked 2021-Aug-13 at 02:35I am able to see the compliance state for VMs(on whom I have applied custom OS policy via OS Configuration Management in VM Manager) in a given project and zone in the Google Cloud console as well as via using API like below:
1GET https://osconfig.googleapis.com/v1alpha/projects/PROJECT_ID/locations/ZONE/instanceOSPoliciesCompliances
2
Is there a way I can view compliance state via Google Cloud Logs Explorer?
If I click on View in the Logs tab above, I am directed to Logs Explorer with the Query framed as:
1GET https://osconfig.googleapis.com/v1alpha/projects/PROJECT_ID/locations/ZONE/instanceOSPoliciesCompliances
2resource.type="gce_instance"
3resource.labels.instance_id="<instance_id>"
4labels.os_policy_assignment="projects/<project_id>/locations/<zone>/osPolicyAssignments/<assignment>@<some_alphanumeric_id>"
5labels.os_policy_id="<custom-policy-id>"
6labels.task_type="APPLY_CONFIG_TASK"
7
But this does not provide me any information on the Compliance State as shown in the screenshot above.
How can I frame a query to get the Compliance State related logs?
ANSWER
Answered 2021-Aug-12 at 14:17To view compliance state in Logs use the following query,
1GET https://osconfig.googleapis.com/v1alpha/projects/PROJECT_ID/locations/ZONE/instanceOSPoliciesCompliances
2resource.type="gce_instance"
3resource.labels.instance_id="<instance_id>"
4labels.os_policy_assignment="projects/<project_id>/locations/<zone>/osPolicyAssignments/<assignment>@<some_alphanumeric_id>"
5labels.os_policy_id="<custom-policy-id>"
6labels.task_type="APPLY_CONFIG_TASK"
7resource.type="gce_instance"
8resource.labels.instance_id="<instance_id>"
9labels.os_policy_assignment="projects/<project_id>/locations/<zone>/osPolicyAssignments/<assignment>@<some_alphanumeric_id>"
10labels.os_policy_id="<custom-policy-id>"
11labels.task_type="APPLY_CONFIG_TASK"
12jsonPayload.message:"state: COMPLIANT"
13
We can find compliant state of VM in “jsonPayload.message” field of a log.
QUESTION
How to use Dynaconf to configure Celery
Asked 2021-Mar-23 at 19:04Recently I discovered Dynaconf which is a nice configuration management package that integrates nicely with Flask and Django. The Django app is running wonderfully with Dynaconf. However the Celery app that my App depends on to run background tasks is not.
Here is the code for the configuration of the Celery app that was working before using Dynaconf:
1from celery import Celery
2app = Celery('KillerApp')
3app.config_from_object('django.conf:settings', namespace='CELERY')
4
It seems that I need to change 'django.conf:settings' to something else. Any ideas?
ANSWER
Answered 2021-Feb-02 at 19:49You can pass in a string representing a module to import, or just pass in the configuration object directly; see the Celery.config_from_object()
method documentation.
You'll have a module that sets up the Dynaconf()
instance, e.g. if you have a package named acme_project
with a config.py
file in it with
1from celery import Celery
2app = Celery('KillerApp')
3app.config_from_object('django.conf:settings', namespace='CELERY')
4from dynaconf import Dynaconf
5
6settings = Dynaconf(
7 settings_files=['settings.toml', '.secrets.toml'],
8)
9
then you can import acme_project.config
and find the settings
object there. You can either import that object or let Celery do that by using 'acme_project.config:settings'
as the value you pass to app.config_from_object()
. The namespace
argument tells Celery to expect all settings to be prefixed with CELERY_
, exactly like the way this works with Django. Use this if you plan to use the Dynaconf-managed settings to configure multiple components, not just Celery.
E.g., if you used:
1from celery import Celery
2app = Celery('KillerApp')
3app.config_from_object('django.conf:settings', namespace='CELERY')
4from dynaconf import Dynaconf
5
6settings = Dynaconf(
7 settings_files=['settings.toml', '.secrets.toml'],
8)
9app.config_from_object('acme_project.config:settings', namespace='CELERY')
10
then your settings.toml
or settings.yaml
or whatever file format you picked would need to use CELERY_
as a prefix for all the settings.
QUESTION
How to use static spring cloud stream url for launching spring cloud tasks?
Asked 2021-Mar-10 at 05:33Platform used : Kubernetes.
I have an issue with Spring cloud stream url. I am launching my spring cloud tasks using spring cloud stream. Streams are deployed in kubernetes platform. Stream contains http-kafka as source and taskLauncerKafka as sink. I used http-kafka kubernetes service url to launch tasks. Kubernetes service url changes after each deployment which causes problem.The changes in the service name after each stream deployment is difficult to manage. I have tried enabling loadbalacer also. In that case also external ip-address changed after each stream roll-out.
I am using skipper for managing the deployments. Every time stream is deployed stream version changes which also changes stream url.
In my case , I have multiple instances from where I can launch spring-cloud task. If the stream url changes I need to make changes in the configmap of the deployment project for all instance and need to redeploy all instance.
Any solution ? I am thinking of centralised configuration management using spring-cloud-config server or zookeeper. In this case also I need to update the url. I can avoid deploying multiple instances using centralised configuration management.
Skipper server version : 2.4.1.RELEASE
Dataflow server version : 2.5.1.RELEASE
ANSWER
Answered 2021-Mar-10 at 04:34Which version of SCDF/Skipper you are running? This looks similar to the issue https://github.com/spring-cloud/spring-cloud-skipper/issues/953 which was subsequently addressed in Skipper 2.6.0.
QUESTION
Bind an array of .NET Core configuration sections to a class or List<class>
Asked 2021-Jan-15 at 01:53I thought it would be useful to define the data for error reporting in a configuration file, say, errordefinitions.json:
1{
2 "errorDefinitions": {
3 "unsupportedExtension": {
4 "errorLevel": 2,
5 "doLog": true,
6 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
7 "doEmail": false,
8 "emailSubject": "",
9 "emailBody": ""
10 },
11 "fileOpenFailed": {
12 "errorLevel": 3,
13 ...
14 }
15 }
16}
17
or
1{
2 "errorDefinitions": {
3 "unsupportedExtension": {
4 "errorLevel": 2,
5 "doLog": true,
6 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
7 "doEmail": false,
8 "emailSubject": "",
9 "emailBody": ""
10 },
11 "fileOpenFailed": {
12 "errorLevel": 3,
13 ...
14 }
15 }
16}
17[
18 {
19 "name":"unsupportedExtension",
20 "errorLevel": 2,
21 "doLog": true,
22 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
23 "doEmail": false,
24 "emailSubject": "",
25 "emailBody": ""
26 },
27 {
28 "name": "fileOpenFailed",
29 "errorLevel": 3,
30 ...
31 }
32]
33
Either way, my expectation was that I'd be able to use Microsoft's built-in configuration management classes to define a class and then fairly straightforwardly bind a class, or a list of items in a class, to these so that I could reference them thus:
(UPDATE I've expanded my example below since I first posted to show more clearly what I have in mind. I want to be able to look up and use an error definition based on its name, without having to wrap each definition in a separate class. A dictionary, essentially, without the application being semantically aware of the meaning of each entry.
When I add a new feature to the application, I want to be able to add the data for any new errors that the new feature may encounter to the configuration file and address those by name as well, without having to add new classes to the error handling infrastructure.
Also, for what it's worth, this is for server-side use--this isn't a result I'm returning to a client.)
1{
2 "errorDefinitions": {
3 "unsupportedExtension": {
4 "errorLevel": 2,
5 "doLog": true,
6 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
7 "doEmail": false,
8 "emailSubject": "",
9 "emailBody": ""
10 },
11 "fileOpenFailed": {
12 "errorLevel": 3,
13 ...
14 }
15 }
16}
17[
18 {
19 "name":"unsupportedExtension",
20 "errorLevel": 2,
21 "doLog": true,
22 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
23 "doEmail": false,
24 "emailSubject": "",
25 "emailBody": ""
26 },
27 {
28 "name": "fileOpenFailed",
29 "errorLevel": 3,
30 ...
31 }
32]
33{
34 ...
35 try
36 {
37 openFile(file);
38 ...
39 }
40 catch (Exception e)
41 {
42 handleError("fileOpenFailed", file.name);
43 ...
44 }
45 ...
46}
47
48public void handleError(string errorName, params object[] values)
49{
50 ErrorDefinition errorDef = ErrorDefinitions[errorName];
51 if (errorDev.doLog)
52 {
53 writeToLog(
54 errorDef.errorLevel,
55 String.Format(errorDef.logMessage, values)
56 );
57 }
58 if (errorDef.doEmail)
59 {
60 sendNotificationToEmailList(
61 errorDef.emailSsubject,
62 errorDef.emailBody
63 );
64 }
65 ...
66}
67
But I've gotten lost in the API. SectionGroups, SectionCollections, SectionGroupCollections; some of them enumerable, some not. Any tips?
ANSWER
Answered 2021-Jan-15 at 01:53It seems that you want map the json file data to the model.
Here is a working demo:
Model:
1{
2 "errorDefinitions": {
3 "unsupportedExtension": {
4 "errorLevel": 2,
5 "doLog": true,
6 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
7 "doEmail": false,
8 "emailSubject": "",
9 "emailBody": ""
10 },
11 "fileOpenFailed": {
12 "errorLevel": 3,
13 ...
14 }
15 }
16}
17[
18 {
19 "name":"unsupportedExtension",
20 "errorLevel": 2,
21 "doLog": true,
22 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
23 "doEmail": false,
24 "emailSubject": "",
25 "emailBody": ""
26 },
27 {
28 "name": "fileOpenFailed",
29 "errorLevel": 3,
30 ...
31 }
32]
33{
34 ...
35 try
36 {
37 openFile(file);
38 ...
39 }
40 catch (Exception e)
41 {
42 handleError("fileOpenFailed", file.name);
43 ...
44 }
45 ...
46}
47
48public void handleError(string errorName, params object[] values)
49{
50 ErrorDefinition errorDef = ErrorDefinitions[errorName];
51 if (errorDev.doLog)
52 {
53 writeToLog(
54 errorDef.errorLevel,
55 String.Format(errorDef.logMessage, values)
56 );
57 }
58 if (errorDef.doEmail)
59 {
60 sendNotificationToEmailList(
61 errorDef.emailSsubject,
62 errorDef.emailBody
63 );
64 }
65 ...
66}
67public class ErrorDefinition
68{
69 public Dictionary<string, Dictionary<string,string>> errorDefinitions
70 {
71 get;
72 set;
73 }
74}
75
Controller:
1{
2 "errorDefinitions": {
3 "unsupportedExtension": {
4 "errorLevel": 2,
5 "doLog": true,
6 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
7 "doEmail": false,
8 "emailSubject": "",
9 "emailBody": ""
10 },
11 "fileOpenFailed": {
12 "errorLevel": 3,
13 ...
14 }
15 }
16}
17[
18 {
19 "name":"unsupportedExtension",
20 "errorLevel": 2,
21 "doLog": true,
22 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
23 "doEmail": false,
24 "emailSubject": "",
25 "emailBody": ""
26 },
27 {
28 "name": "fileOpenFailed",
29 "errorLevel": 3,
30 ...
31 }
32]
33{
34 ...
35 try
36 {
37 openFile(file);
38 ...
39 }
40 catch (Exception e)
41 {
42 handleError("fileOpenFailed", file.name);
43 ...
44 }
45 ...
46}
47
48public void handleError(string errorName, params object[] values)
49{
50 ErrorDefinition errorDef = ErrorDefinitions[errorName];
51 if (errorDev.doLog)
52 {
53 writeToLog(
54 errorDef.errorLevel,
55 String.Format(errorDef.logMessage, values)
56 );
57 }
58 if (errorDef.doEmail)
59 {
60 sendNotificationToEmailList(
61 errorDef.emailSsubject,
62 errorDef.emailBody
63 );
64 }
65 ...
66}
67public class ErrorDefinition
68{
69 public Dictionary<string, Dictionary<string,string>> errorDefinitions
70 {
71 get;
72 set;
73 }
74}
75public ActionResult Index()
76{
77 var configuration = new ConfigurationBuilder()
78 .SetBasePath(Directory.GetCurrentDirectory())
79 .AddJsonFile("errordefinitions.json", false)
80 .Build();
81
82 var config = configuration.Get<ErrorDefinition>();
83 var data = config.errorDefinitions["fileOpenFailed"]
84 .FirstOrDefault(x=>x.Key== "logMessage").Value;
85 return View();
86}
87
errordefinitions.json in root project:
1{
2 "errorDefinitions": {
3 "unsupportedExtension": {
4 "errorLevel": 2,
5 "doLog": true,
6 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
7 "doEmail": false,
8 "emailSubject": "",
9 "emailBody": ""
10 },
11 "fileOpenFailed": {
12 "errorLevel": 3,
13 ...
14 }
15 }
16}
17[
18 {
19 "name":"unsupportedExtension",
20 "errorLevel": 2,
21 "doLog": true,
22 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
23 "doEmail": false,
24 "emailSubject": "",
25 "emailBody": ""
26 },
27 {
28 "name": "fileOpenFailed",
29 "errorLevel": 3,
30 ...
31 }
32]
33{
34 ...
35 try
36 {
37 openFile(file);
38 ...
39 }
40 catch (Exception e)
41 {
42 handleError("fileOpenFailed", file.name);
43 ...
44 }
45 ...
46}
47
48public void handleError(string errorName, params object[] values)
49{
50 ErrorDefinition errorDef = ErrorDefinitions[errorName];
51 if (errorDev.doLog)
52 {
53 writeToLog(
54 errorDef.errorLevel,
55 String.Format(errorDef.logMessage, values)
56 );
57 }
58 if (errorDef.doEmail)
59 {
60 sendNotificationToEmailList(
61 errorDef.emailSsubject,
62 errorDef.emailBody
63 );
64 }
65 ...
66}
67public class ErrorDefinition
68{
69 public Dictionary<string, Dictionary<string,string>> errorDefinitions
70 {
71 get;
72 set;
73 }
74}
75public ActionResult Index()
76{
77 var configuration = new ConfigurationBuilder()
78 .SetBasePath(Directory.GetCurrentDirectory())
79 .AddJsonFile("errordefinitions.json", false)
80 .Build();
81
82 var config = configuration.Get<ErrorDefinition>();
83 var data = config.errorDefinitions["fileOpenFailed"]
84 .FirstOrDefault(x=>x.Key== "logMessage").Value;
85 return View();
86}
87{
88 "errorDefinitions": {
89 "unsupportedExtension": {
90 "errorLevel": 2,
91 "doLog": true,
92 "logMessage": "The file {0} doesn't have a valid extension for this operation.",
93 "doEmail": false,
94 "emailSubject": "",
95 "emailBody": ""
96 },
97 "fileOpenFailed": {
98 "errorLevel": 3,
99 "doLog": true,
100 "logMessage": "The file {0} cannot be opened.",
101 "doEmail": false,
102 "emailSubject": "",
103 "emailBody": ""
104 }
105 }
106}
107
QUESTION
unable to uprade marklogic data hub framework using gradle
Asked 2020-Dec-14 at 06:04I am trying to follow the recommendation to upgrade the DHF using gradle but I am running through an issue that I cannot het my head around.
The build succeeds but the redeployment fails Any idea on how to fix this ?
note that the login info is provided properly in the gradle.properties
1> Task :hubDeploySecurity FAILED
2Task ':hubDeploySecurity' is not up-to-date because:
3 Task has not declared any outputs despite executing actions.
4Deploying app DHF with config dirs: [/src/main/hub-internal-config, /src/main/ml-config]
5
6Executing command [com.marklogic.appdeployer.command.security.DeployPrivilegesCommand] with sort order [5]
7Will read and merge resource files in each config path before saving any resources
8Processing files in directory: /src/main/hub-internal-config/security/privileges
9Checking to see if Configuration Management API is available at: /manage/v3
10Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
11Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
12Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-data-hub.json
13Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-entities.json
14Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-mappings.json
15Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-trace-ui.json
16Processing files in directory: /src/main/ml-config/security/privileges
17Checking to see if Configuration Management API is available at: /manage/v3
18Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
19Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
20Merging payloads that reference the same resource
21Checking to see if Configuration Management API is available at: /manage/v3
22Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
23Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
24Checking for existence of resource: dhf-internal-data-hub
25Sending XML GET request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v2/privileges
26Logging HTTP response body to assist with debugging: {"errorResponse": {"statusCode":401,
27 "status":"Unauthorized",
28 "message":"401 Unauthorized"
29 }
30}
31:hubDeploySecurity (Thread[Execution worker for ':',5,main]) completed. Took 0.01 secs.
32
33FAILURE: Build failed with an exception.
34
35* What went wrong:
36Execution failed for task ':hubDeploySecurity'.
37> 401 Unauthorized: [{"errorResponse": {"statusCode":401,
38 "status":"Unauthorized",
39 "message":"401 Unauthorized"
40 }
41 }]
42
ANSWER
Answered 2020-Dec-14 at 06:04Assuming you have followed the DHF upgrade matrix:
1> Task :hubDeploySecurity FAILED
2Task ':hubDeploySecurity' is not up-to-date because:
3 Task has not declared any outputs despite executing actions.
4Deploying app DHF with config dirs: [/src/main/hub-internal-config, /src/main/ml-config]
5
6Executing command [com.marklogic.appdeployer.command.security.DeployPrivilegesCommand] with sort order [5]
7Will read and merge resource files in each config path before saving any resources
8Processing files in directory: /src/main/hub-internal-config/security/privileges
9Checking to see if Configuration Management API is available at: /manage/v3
10Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
11Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
12Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-data-hub.json
13Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-entities.json
14Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-mappings.json
15Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-trace-ui.json
16Processing files in directory: /src/main/ml-config/security/privileges
17Checking to see if Configuration Management API is available at: /manage/v3
18Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
19Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
20Merging payloads that reference the same resource
21Checking to see if Configuration Management API is available at: /manage/v3
22Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
23Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
24Checking for existence of resource: dhf-internal-data-hub
25Sending XML GET request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v2/privileges
26Logging HTTP response body to assist with debugging: {"errorResponse": {"statusCode":401,
27 "status":"Unauthorized",
28 "message":"401 Unauthorized"
29 }
30}
31:hubDeploySecurity (Thread[Execution worker for ':',5,main]) completed. Took 0.01 secs.
32
33FAILURE: Build failed with an exception.
34
35* What went wrong:
36Execution failed for task ':hubDeploySecurity'.
37> 401 Unauthorized: [{"errorResponse": {"statusCode":401,
38 "status":"Unauthorized",
39 "message":"401 Unauthorized"
40 }
41 }]
42https://docs.marklogic.com/datahub/5.2/upgrade.html
43
You probably ran the Gradle with an incorrect Admin interface & Security user. As such, the hubUpdate
REST API requests will fail.
Try below see if it works:
Step 2
1> Task :hubDeploySecurity FAILED
2Task ':hubDeploySecurity' is not up-to-date because:
3 Task has not declared any outputs despite executing actions.
4Deploying app DHF with config dirs: [/src/main/hub-internal-config, /src/main/ml-config]
5
6Executing command [com.marklogic.appdeployer.command.security.DeployPrivilegesCommand] with sort order [5]
7Will read and merge resource files in each config path before saving any resources
8Processing files in directory: /src/main/hub-internal-config/security/privileges
9Checking to see if Configuration Management API is available at: /manage/v3
10Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
11Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
12Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-data-hub.json
13Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-entities.json
14Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-mappings.json
15Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-trace-ui.json
16Processing files in directory: /src/main/ml-config/security/privileges
17Checking to see if Configuration Management API is available at: /manage/v3
18Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
19Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
20Merging payloads that reference the same resource
21Checking to see if Configuration Management API is available at: /manage/v3
22Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
23Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
24Checking for existence of resource: dhf-internal-data-hub
25Sending XML GET request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v2/privileges
26Logging HTTP response body to assist with debugging: {"errorResponse": {"statusCode":401,
27 "status":"Unauthorized",
28 "message":"401 Unauthorized"
29 }
30}
31:hubDeploySecurity (Thread[Execution worker for ':',5,main]) completed. Took 0.01 secs.
32
33FAILURE: Build failed with an exception.
34
35* What went wrong:
36Execution failed for task ':hubDeploySecurity'.
37> 401 Unauthorized: [{"errorResponse": {"statusCode":401,
38 "status":"Unauthorized",
39 "message":"401 Unauthorized"
40 }
41 }]
42https://docs.marklogic.com/datahub/5.2/upgrade.html
43gradle hubUpdate -i -PmlUsername=admin -PmlPassword={admin-password} -Penvironment={env-name}
44
Step 4
1> Task :hubDeploySecurity FAILED
2Task ':hubDeploySecurity' is not up-to-date because:
3 Task has not declared any outputs despite executing actions.
4Deploying app DHF with config dirs: [/src/main/hub-internal-config, /src/main/ml-config]
5
6Executing command [com.marklogic.appdeployer.command.security.DeployPrivilegesCommand] with sort order [5]
7Will read and merge resource files in each config path before saving any resources
8Processing files in directory: /src/main/hub-internal-config/security/privileges
9Checking to see if Configuration Management API is available at: /manage/v3
10Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
11Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
12Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-data-hub.json
13Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-entities.json
14Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-mappings.json
15Processing file: /src/main/hub-internal-config/security/privileges/dhf-internal-trace-ui.json
16Processing files in directory: /src/main/ml-config/security/privileges
17Checking to see if Configuration Management API is available at: /manage/v3
18Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
19Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
20Merging payloads that reference the same resource
21Checking to see if Configuration Management API is available at: /manage/v3
22Sending JSON POST request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v3
23Error occurred while sending POST request to /manage/v3; logging request body to assist with debugging: {}
24Checking for existence of resource: dhf-internal-data-hub
25Sending XML GET request as user 'tkadmin' (who should have the 'manage-admin' and 'security' roles) to path: /manage/v2/privileges
26Logging HTTP response body to assist with debugging: {"errorResponse": {"statusCode":401,
27 "status":"Unauthorized",
28 "message":"401 Unauthorized"
29 }
30}
31:hubDeploySecurity (Thread[Execution worker for ':',5,main]) completed. Took 0.01 secs.
32
33FAILURE: Build failed with an exception.
34
35* What went wrong:
36Execution failed for task ':hubDeploySecurity'.
37> 401 Unauthorized: [{"errorResponse": {"statusCode":401,
38 "status":"Unauthorized",
39 "message":"401 Unauthorized"
40 }
41 }]
42https://docs.marklogic.com/datahub/5.2/upgrade.html
43gradle hubUpdate -i -PmlUsername=admin -PmlPassword={admin-password} -Penvironment={env-name}
44gradle mlRedeploy -i -PmlUsername=admin -PmlPassword={admin-password} -Penvironment={env-name}
45
Community Discussions contain sources that include Stack Exchange Network
Tutorials and Learning Resources in Configuration Management
Tutorials and Learning Resources are not available at this moment for Configuration Management