Explore all Configuration Management open source software, libraries, packages, source code, cloud functions and APIs.

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

dotfiles

by mathiasbynens doticonshelldoticon

star image 26792 doticonMIT

:wrench: .files, including ~/.macos — sensible hacker defaults for macOS

consul

by hashicorp doticongodoticon

star image 24633 doticonMPL-2.0

Consul is a distributed, highly available, and data center aware solution to connect and configure applications across dynamic, distributed infrastructure.

viper

by spf13 doticongodoticon

star image 18971 doticonMIT

Go configuration with fangs

eureka

by Netflix doticonjavadoticon

star image 10478 doticonApache-2.0

AWS Service registry for resilient mid-tier load balancing and failover.

confd

by kelseyhightower doticongodoticon

star image 7475 doticonMIT

Manage local application configuration files using templates and data from etcd or consul

dotfiles

by thoughtbot doticonshelldoticon

star image 6628 doticonNOASSERTION

A set of vim, zsh, git, and tmux configuration files.

chezmoi

by twpayne doticongodoticon

star image 6468 doticonMIT

Manage your dotfiles across multiple diverse machines, securely.

comparator

by sebastianbergmann doticonphpdoticon

star image 6243 doticonNOASSERTION

Provides the functionality to compare PHP values for equality.

dotfiles

by holman doticonshelldoticon

star image 6224 doticonMIT

@holman does dotfiles

Trending New libraries in Configuration Management

dotfiles

by owl4ce doticoncssdoticon

star image 1488 doticonGPL-3.0

:cherry_blossom: Aesthetic OpenboxWM Environment

v2ray-examples

by v2fly doticoncssdoticon

star image 882 doticon

v2ray-core 的模板们

dotfiles-2.0

by Axarva doticonshelldoticon

star image 717 doticonMIT

XMonad™️. Widgets go brr.

laravel-settings

by spatie doticonphpdoticon

star image 634 doticonMIT

Store strongly typed application settings

ptSh

by jszczerbinsky doticoncdoticon

star image 469 doticonMIT

Visually customizable shell utils

dotcommon

by Kharacternyk doticonpythondoticon

star image 460 doticonGPL-3.0

What do people have in their dotfiles?

hashi-up

by jsiebens doticongodoticon

star image 381 doticonMIT

bootstrap HashiCorp Consul, Nomad, or Vault over SSH < 1 minute

anmolsingh.me

by anmol098 doticonjavascriptdoticon

star image 332 doticonMIT

This is my personal website here I keep updating changes which cannot be summed up in my Resume

Brewlet

by zkokaja doticonswiftdoticon

star image 320 doticonBSD-2-Clause

The missing menulet for brew.sh: keeping your packages up-to-date, and your system secure.

Top Authors in Configuration Management

1

puppetlabs

90 Libraries

star icon4114

2

voxpupuli

66 Libraries

star icon2789

3

cookbooks

54 Libraries

star icon163

4

simp

45 Libraries

star icon123

5

chef-boneyard

41 Libraries

star icon1695

6

froschi

29 Libraries

star icon304

7

ghoneycutt

26 Libraries

star icon154

8

sous-chefs

24 Libraries

star icon838

9

theforeman

20 Libraries

star icon580

10

camptocamp

19 Libraries

star icon503

1

90 Libraries

star icon4114

2

66 Libraries

star icon2789

3

54 Libraries

star icon163

4

45 Libraries

star icon123

5

41 Libraries

star icon1695

6

29 Libraries

star icon304

7

26 Libraries

star icon154

8

24 Libraries

star icon838

9

20 Libraries

star icon580

10

19 Libraries

star icon503

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&lt;class&gt;

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:27
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 = &quot;C:\Rohan\Automations\CM Plan Automation\Upload\&quot;
10    filename = Range(&quot;C4&quot;).Text
11    Set ws = ActiveSheet
12    Set msWord = CreateObject(&quot;Word.Application&quot;)
13
14    With msWord
15        .Visible = True
16        .documents.Open &quot;C:\Rohan\Automations\CM Plan Automation\Engagement Name_Configuration Management Plan.docx&quot;
17        .Activate
18
19        With .ActiveDocument.Content.Find
20            .ClearFormatting
21            .Replacement.ClearFormatting
22
23            For Each itm In ws.UsedRange.Columns(&quot;B&quot;).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 &amp; _
39FileFormat:=wdFormatDocumentDefault, AddtoRecentFiles:=False
40        
41        '.Quit SaveChanges:=True
42         
43        '.Quit
44        
45        '.SaveAs2 Filename:=(&quot;file name goes here&quot;), _
46    FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False
47        
48        
49       '.SaveAs filename:=filename &amp; &quot;.docx&quot;
50        
51       '.SaveAs2 filename:=&quot;C:\Rohan\Automations\CM Plan Automation\Upload\&quot; &amp; &quot;.docx&quot;,
52        'FileFormat:=wdFormatDocumentDefault
53        
54        
55        
56    End With
57    
58    MsgBox &quot;Done&quot;
59    
60    
61End Sub
62

ANSWER

Answered 2022-Mar-09 at 08:27

The 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 = &quot;C:\Rohan\Automations\CM Plan Automation\Upload\&quot;
10    filename = Range(&quot;C4&quot;).Text
11    Set ws = ActiveSheet
12    Set msWord = CreateObject(&quot;Word.Application&quot;)
13
14    With msWord
15        .Visible = True
16        .documents.Open &quot;C:\Rohan\Automations\CM Plan Automation\Engagement Name_Configuration Management Plan.docx&quot;
17        .Activate
18
19        With .ActiveDocument.Content.Find
20            .ClearFormatting
21            .Replacement.ClearFormatting
22
23            For Each itm In ws.UsedRange.Columns(&quot;B&quot;).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 &amp; _
39FileFormat:=wdFormatDocumentDefault, AddtoRecentFiles:=False
40        
41        '.Quit SaveChanges:=True
42         
43        '.Quit
44        
45        '.SaveAs2 Filename:=(&quot;file name goes here&quot;), _
46    FileFormat:=wdFormatXMLDocument, AddtoRecentFiles:=False
47        
48        
49       '.SaveAs filename:=filename &amp; &quot;.docx&quot;
50        
51       '.SaveAs2 filename:=&quot;C:\Rohan\Automations\CM Plan Automation\Upload\&quot; &amp; &quot;.docx&quot;,
52        'FileFormat:=wdFormatDocumentDefault
53        
54        
55        
56    End With
57    
58    MsgBox &quot;Done&quot;
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 = &quot;C:\Rohan\Automations\CM Plan Automation\Upload\&quot;
71    filename = Range(&quot;C4&quot;).Text
72    Set ws = ActiveSheet
73    Set msWord = CreateObject(&quot;Word.Application&quot;)
74
75    With msWord
76        .Visible = True
77        Set wrdDoc = .documents.Open(&quot;C:\Rohan\Automations\CM Plan Automation\Engagement Name_Configuration Management Plan.docx&quot;)
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(&quot;B&quot;).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 &quot;Done&quot;
101    
102End Sub
103

Source https://stackoverflow.com/questions/71171179

QUESTION

Using Typer and Hydra together

Asked 2022-Jan-24 at 09:28

I have a simple Typer application:

1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7    print(&quot;Hi&quot;)
8
9@app.callback()
10def main():
11    pass
12
13if __name__ == &quot;__main__&quot;:
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(&quot;Hi&quot;)
8
9@app.callback()
10def main():
11    pass
12
13if __name__ == &quot;__main__&quot;:
14    app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23    print(&quot;Hi&quot;)
24
25@app.callback()
26@hydra.main(config_path=&quot;conf&quot;, config_name=&quot;config&quot;)
27def main(cfg: DictConfig) -&gt; None:
28    print(OmegaConf.to_yaml(cfg))
29
30if __name__ == &quot;__main__&quot;:
31    app()
32

But I get an error saying:

1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7    print(&quot;Hi&quot;)
8
9@app.callback()
10def main():
11    pass
12
13if __name__ == &quot;__main__&quot;:
14    app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23    print(&quot;Hi&quot;)
24
25@app.callback()
26@hydra.main(config_path=&quot;conf&quot;, config_name=&quot;config&quot;)
27def main(cfg: DictConfig) -&gt; None:
28    print(OmegaConf.to_yaml(cfg))
29
30if __name__ == &quot;__main__&quot;:
31    app()
32RuntimeError: Type not yet supported: &lt;class 'omegaconf.dictconfig.DictConfig'&gt;
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(&quot;Hi&quot;)
8
9@app.callback()
10def main():
11    pass
12
13if __name__ == &quot;__main__&quot;:
14    app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23    print(&quot;Hi&quot;)
24
25@app.callback()
26@hydra.main(config_path=&quot;conf&quot;, config_name=&quot;config&quot;)
27def main(cfg: DictConfig) -&gt; None:
28    print(OmegaConf.to_yaml(cfg))
29
30if __name__ == &quot;__main__&quot;:
31    app()
32RuntimeError: Type not yet supported: &lt;class 'omegaconf.dictconfig.DictConfig'&gt;
33@app.callback()
34def main() -&gt; None:
35    with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
36        cfg = compose(config_name=&quot;config&quot;)
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:28

The compose function accepts an optional list of override strings:

1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7    print(&quot;Hi&quot;)
8
9@app.callback()
10def main():
11    pass
12
13if __name__ == &quot;__main__&quot;:
14    app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23    print(&quot;Hi&quot;)
24
25@app.callback()
26@hydra.main(config_path=&quot;conf&quot;, config_name=&quot;config&quot;)
27def main(cfg: DictConfig) -&gt; None:
28    print(OmegaConf.to_yaml(cfg))
29
30if __name__ == &quot;__main__&quot;:
31    app()
32RuntimeError: Type not yet supported: &lt;class 'omegaconf.dictconfig.DictConfig'&gt;
33@app.callback()
34def main() -&gt; None:
35    with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
36        cfg = compose(config_name=&quot;config&quot;)
37        print(OmegaConf.to_yaml(cfg))
38with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
39    cfg = compose(config_name=&quot;config&quot;, overrides=[&quot;db=mysql&quot;, &quot;db.user=me&quot;])
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(&quot;Hi&quot;)
8
9@app.callback()
10def main():
11    pass
12
13if __name__ == &quot;__main__&quot;:
14    app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23    print(&quot;Hi&quot;)
24
25@app.callback()
26@hydra.main(config_path=&quot;conf&quot;, config_name=&quot;config&quot;)
27def main(cfg: DictConfig) -&gt; None:
28    print(OmegaConf.to_yaml(cfg))
29
30if __name__ == &quot;__main__&quot;:
31    app()
32RuntimeError: Type not yet supported: &lt;class 'omegaconf.dictconfig.DictConfig'&gt;
33@app.callback()
34def main() -&gt; None:
35    with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
36        cfg = compose(config_name=&quot;config&quot;)
37        print(OmegaConf.to_yaml(cfg))
38with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
39    cfg = compose(config_name=&quot;config&quot;, overrides=[&quot;db=mysql&quot;, &quot;db.user=me&quot;])
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]]) -&gt; DictConfig:
50    with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
51        return compose(config_name=&quot;config&quot;, overrides=overrides)
52
53@app.command()
54def say_hi(overrides: Optional[List[str]] = typer.Argument(None)):
55    print(&quot;HI!&quot;)
56    print(f&quot;Got {overrides=}&quot;)
57    cfg = my_compose(overrides)
58    print(&quot;\nHydra config:&quot;)
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(&quot;BYE!&quot;)
66
67if __name__ == &quot;__main__&quot;:
68    app()
69
1import typer
2
3app = typer.Typer()
4
5@app.command()
6def say_hi():
7    print(&quot;Hi&quot;)
8
9@app.callback()
10def main():
11    pass
12
13if __name__ == &quot;__main__&quot;:
14    app()
15import hydra
16import typer
17from omegaconf import DictConfig, OmegaConf
18
19app = typer.Typer()
20
21@app.command()
22def say_hi():
23    print(&quot;Hi&quot;)
24
25@app.callback()
26@hydra.main(config_path=&quot;conf&quot;, config_name=&quot;config&quot;)
27def main(cfg: DictConfig) -&gt; None:
28    print(OmegaConf.to_yaml(cfg))
29
30if __name__ == &quot;__main__&quot;:
31    app()
32RuntimeError: Type not yet supported: &lt;class 'omegaconf.dictconfig.DictConfig'&gt;
33@app.callback()
34def main() -&gt; None:
35    with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
36        cfg = compose(config_name=&quot;config&quot;)
37        print(OmegaConf.to_yaml(cfg))
38with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
39    cfg = compose(config_name=&quot;config&quot;, overrides=[&quot;db=mysql&quot;, &quot;db.user=me&quot;])
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]]) -&gt; DictConfig:
50    with initialize(config_path=&quot;conf&quot;, job_name=&quot;test_app&quot;):
51        return compose(config_name=&quot;config&quot;, overrides=overrides)
52
53@app.command()
54def say_hi(overrides: Optional[List[str]] = typer.Argument(None)):
55    print(&quot;HI!&quot;)
56    print(f&quot;Got {overrides=}&quot;)
57    cfg = my_compose(overrides)
58    print(&quot;\nHydra config:&quot;)
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(&quot;BYE!&quot;)
66
67if __name__ == &quot;__main__&quot;:
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

Source https://stackoverflow.com/questions/70811640

QUESTION

how to stop letter repeating itself python

Asked 2021-Nov-25 at 18:33

I 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(&quot;data.json&quot;)
4val1 = json.load(val)#loads the list
5
6
7a = input(&quot;Enter a Jumbled word &quot;)#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(&quot;data.json&quot;)
4val1 = json.load(val)#loads the list
5
6
7a = input(&quot;Enter a Jumbled word &quot;)#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', &quot;queen's guard&quot;, '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', &quot;devil's advocate&quot;, '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', &quot;couldn't-care-less attitude&quot;, '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:33

As 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(&quot;data.json&quot;)
4val1 = json.load(val)#loads the list
5
6
7a = input(&quot;Enter a Jumbled word &quot;)#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', &quot;queen's guard&quot;, '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', &quot;devil's advocate&quot;, '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', &quot;couldn't-care-less attitude&quot;, '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(" ", "")

Source https://stackoverflow.com/questions/70112201

QUESTION

A paradox - putting my Ansible server under CM control?

Asked 2021-Nov-15 at 12:08

I'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:08

It'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.

Source https://stackoverflow.com/questions/69972968

QUESTION

WSO2-IS 5.11.0 - CORS management service error when intercepting an HTTP request - MySQL DB

Asked 2021-Aug-29 at 20:22

I'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 = &quot;h2&quot;
3url = &quot;jdbc:h2:./repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000&quot;
4username = &quot;wso2carbon&quot;
5password = &quot;wso2carbon&quot;
6

This doesn't work

1[database.identity_db]
2type = &quot;h2&quot;
3url = &quot;jdbc:h2:./repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000&quot;
4username = &quot;wso2carbon&quot;
5password = &quot;wso2carbon&quot;
6[database.identity_db]
7type = &quot;mysql&quot;
8url = &quot;jdbc:mysql://csm-wso2-mysqldb:3306/WSO2_IDENTITY_DB?autoReconnect=true&amp;amp;useSSL=false&quot;
9username = &quot;regadmin&quot;
10password = &quot;regadmin&quot;
11driver = &quot;com.mysql.cj.jdbc.Driver&quot;
12

csm-wso2-mysqldb is a docker container name

Error:

1[database.identity_db]
2type = &quot;h2&quot;
3url = &quot;jdbc:h2:./repository/database/WSO2IDENTITY_DB;DB_CLOSE_ON_EXIT=FALSE;LOCK_TIMEOUT=60000&quot;
4username = &quot;wso2carbon&quot;
5password = &quot;wso2carbon&quot;
6[database.identity_db]
7type = &quot;mysql&quot;
8url = &quot;jdbc:mysql://csm-wso2-mysqldb:3306/WSO2_IDENTITY_DB?autoReconnect=true&amp;amp;useSSL=false&quot;
9username = &quot;regadmin&quot;
10password = &quot;regadmin&quot;
11driver = &quot;com.mysql.cj.jdbc.Driver&quot;
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:22

I 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.

Source https://stackoverflow.com/questions/68967131

QUESTION

How to query for VM compliance report in Google Cloud Logs Explorer

Asked 2021-Aug-13 at 02:35

I 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?

enter image description here

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=&quot;gce_instance&quot; 
3resource.labels.instance_id=&quot;&lt;instance_id&gt;&quot; 
4labels.os_policy_assignment=&quot;projects/&lt;project_id&gt;/locations/&lt;zone&gt;/osPolicyAssignments/&lt;assignment&gt;@&lt;some_alphanumeric_id&gt;&quot; 
5labels.os_policy_id=&quot;&lt;custom-policy-id&gt;&quot; 
6labels.task_type=&quot;APPLY_CONFIG_TASK&quot;
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:17

To view compliance state in Logs use the following query,

1GET https://osconfig.googleapis.com/v1alpha/projects/PROJECT_ID/locations/ZONE/instanceOSPoliciesCompliances
2resource.type=&quot;gce_instance&quot; 
3resource.labels.instance_id=&quot;&lt;instance_id&gt;&quot; 
4labels.os_policy_assignment=&quot;projects/&lt;project_id&gt;/locations/&lt;zone&gt;/osPolicyAssignments/&lt;assignment&gt;@&lt;some_alphanumeric_id&gt;&quot; 
5labels.os_policy_id=&quot;&lt;custom-policy-id&gt;&quot; 
6labels.task_type=&quot;APPLY_CONFIG_TASK&quot;
7resource.type=&quot;gce_instance&quot; 
8resource.labels.instance_id=&quot;&lt;instance_id&gt;&quot; 
9labels.os_policy_assignment=&quot;projects/&lt;project_id&gt;/locations/&lt;zone&gt;/osPolicyAssignments/&lt;assignment&gt;@&lt;some_alphanumeric_id&gt;&quot; 
10labels.os_policy_id=&quot;&lt;custom-policy-id&gt;&quot;
11labels.task_type=&quot;APPLY_CONFIG_TASK&quot;
12jsonPayload.message:&quot;state: COMPLIANT&quot;
13

We can find compliant state of VM in “jsonPayload.message” field of a log.

Source https://stackoverflow.com/questions/68738503

QUESTION

How to use Dynaconf to configure Celery

Asked 2021-Mar-23 at 19:04

Recently 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:49

You 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.

Source https://stackoverflow.com/questions/66016398

QUESTION

How to use static spring cloud stream url for launching spring cloud tasks?

Asked 2021-Mar-10 at 05:33

Platform 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:34

Which 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.

Source https://stackoverflow.com/questions/66545882

QUESTION

Bind an array of .NET Core configuration sections to a class or List&lt;class&gt;

Asked 2021-Jan-15 at 01:53

I thought it would be useful to define the data for error reporting in a configuration file, say, errordefinitions.json:

1{
2  &quot;errorDefinitions&quot;: {
3    &quot;unsupportedExtension&quot;: {
4      &quot;errorLevel&quot;: 2,
5      &quot;doLog&quot;: true,
6      &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
7      &quot;doEmail&quot;: false,
8      &quot;emailSubject&quot;: &quot;&quot;,
9      &quot;emailBody&quot;: &quot;&quot;
10    },
11    &quot;fileOpenFailed&quot;: {
12      &quot;errorLevel&quot;: 3,
13      ...
14    }
15  }
16}
17

or

1{
2  &quot;errorDefinitions&quot;: {
3    &quot;unsupportedExtension&quot;: {
4      &quot;errorLevel&quot;: 2,
5      &quot;doLog&quot;: true,
6      &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
7      &quot;doEmail&quot;: false,
8      &quot;emailSubject&quot;: &quot;&quot;,
9      &quot;emailBody&quot;: &quot;&quot;
10    },
11    &quot;fileOpenFailed&quot;: {
12      &quot;errorLevel&quot;: 3,
13      ...
14    }
15  }
16}
17[
18  {
19    &quot;name&quot;:&quot;unsupportedExtension&quot;,
20    &quot;errorLevel&quot;: 2,
21    &quot;doLog&quot;: true,
22    &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
23    &quot;doEmail&quot;: false,
24    &quot;emailSubject&quot;: &quot;&quot;,
25    &quot;emailBody&quot;: &quot;&quot;
26  },
27  {
28    &quot;name&quot;: &quot;fileOpenFailed&quot;,
29    &quot;errorLevel&quot;: 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  &quot;errorDefinitions&quot;: {
3    &quot;unsupportedExtension&quot;: {
4      &quot;errorLevel&quot;: 2,
5      &quot;doLog&quot;: true,
6      &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
7      &quot;doEmail&quot;: false,
8      &quot;emailSubject&quot;: &quot;&quot;,
9      &quot;emailBody&quot;: &quot;&quot;
10    },
11    &quot;fileOpenFailed&quot;: {
12      &quot;errorLevel&quot;: 3,
13      ...
14    }
15  }
16}
17[
18  {
19    &quot;name&quot;:&quot;unsupportedExtension&quot;,
20    &quot;errorLevel&quot;: 2,
21    &quot;doLog&quot;: true,
22    &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
23    &quot;doEmail&quot;: false,
24    &quot;emailSubject&quot;: &quot;&quot;,
25    &quot;emailBody&quot;: &quot;&quot;
26  },
27  {
28    &quot;name&quot;: &quot;fileOpenFailed&quot;,
29    &quot;errorLevel&quot;: 3,
30    ...
31  }
32]
33{
34  ...
35  try
36  {
37    openFile(file);
38    ...
39  }
40  catch (Exception e)
41  {
42    handleError(&quot;fileOpenFailed&quot;, 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:53

It seems that you want map the json file data to the model.

Here is a working demo:

Model:

1{
2  &quot;errorDefinitions&quot;: {
3    &quot;unsupportedExtension&quot;: {
4      &quot;errorLevel&quot;: 2,
5      &quot;doLog&quot;: true,
6      &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
7      &quot;doEmail&quot;: false,
8      &quot;emailSubject&quot;: &quot;&quot;,
9      &quot;emailBody&quot;: &quot;&quot;
10    },
11    &quot;fileOpenFailed&quot;: {
12      &quot;errorLevel&quot;: 3,
13      ...
14    }
15  }
16}
17[
18  {
19    &quot;name&quot;:&quot;unsupportedExtension&quot;,
20    &quot;errorLevel&quot;: 2,
21    &quot;doLog&quot;: true,
22    &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
23    &quot;doEmail&quot;: false,
24    &quot;emailSubject&quot;: &quot;&quot;,
25    &quot;emailBody&quot;: &quot;&quot;
26  },
27  {
28    &quot;name&quot;: &quot;fileOpenFailed&quot;,
29    &quot;errorLevel&quot;: 3,
30    ...
31  }
32]
33{
34  ...
35  try
36  {
37    openFile(file);
38    ...
39  }
40  catch (Exception e)
41  {
42    handleError(&quot;fileOpenFailed&quot;, 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&lt;string, Dictionary&lt;string,string&gt;&gt; errorDefinitions
70    {
71        get;
72        set;
73    }
74}
75

Controller:

1{
2  &quot;errorDefinitions&quot;: {
3    &quot;unsupportedExtension&quot;: {
4      &quot;errorLevel&quot;: 2,
5      &quot;doLog&quot;: true,
6      &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
7      &quot;doEmail&quot;: false,
8      &quot;emailSubject&quot;: &quot;&quot;,
9      &quot;emailBody&quot;: &quot;&quot;
10    },
11    &quot;fileOpenFailed&quot;: {
12      &quot;errorLevel&quot;: 3,
13      ...
14    }
15  }
16}
17[
18  {
19    &quot;name&quot;:&quot;unsupportedExtension&quot;,
20    &quot;errorLevel&quot;: 2,
21    &quot;doLog&quot;: true,
22    &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
23    &quot;doEmail&quot;: false,
24    &quot;emailSubject&quot;: &quot;&quot;,
25    &quot;emailBody&quot;: &quot;&quot;
26  },
27  {
28    &quot;name&quot;: &quot;fileOpenFailed&quot;,
29    &quot;errorLevel&quot;: 3,
30    ...
31  }
32]
33{
34  ...
35  try
36  {
37    openFile(file);
38    ...
39  }
40  catch (Exception e)
41  {
42    handleError(&quot;fileOpenFailed&quot;, 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&lt;string, Dictionary&lt;string,string&gt;&gt; errorDefinitions
70    {
71        get;
72        set;
73    }
74}
75public ActionResult Index()
76{
77    var configuration = new ConfigurationBuilder()
78                        .SetBasePath(Directory.GetCurrentDirectory())
79                        .AddJsonFile(&quot;errordefinitions.json&quot;, false)
80                        .Build();
81
82    var config = configuration.Get&lt;ErrorDefinition&gt;();
83    var data = config.errorDefinitions[&quot;fileOpenFailed&quot;]
84                        .FirstOrDefault(x=&gt;x.Key== &quot;logMessage&quot;).Value;
85    return View();
86}
87

errordefinitions.json in root project:

1{
2  &quot;errorDefinitions&quot;: {
3    &quot;unsupportedExtension&quot;: {
4      &quot;errorLevel&quot;: 2,
5      &quot;doLog&quot;: true,
6      &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
7      &quot;doEmail&quot;: false,
8      &quot;emailSubject&quot;: &quot;&quot;,
9      &quot;emailBody&quot;: &quot;&quot;
10    },
11    &quot;fileOpenFailed&quot;: {
12      &quot;errorLevel&quot;: 3,
13      ...
14    }
15  }
16}
17[
18  {
19    &quot;name&quot;:&quot;unsupportedExtension&quot;,
20    &quot;errorLevel&quot;: 2,
21    &quot;doLog&quot;: true,
22    &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
23    &quot;doEmail&quot;: false,
24    &quot;emailSubject&quot;: &quot;&quot;,
25    &quot;emailBody&quot;: &quot;&quot;
26  },
27  {
28    &quot;name&quot;: &quot;fileOpenFailed&quot;,
29    &quot;errorLevel&quot;: 3,
30    ...
31  }
32]
33{
34  ...
35  try
36  {
37    openFile(file);
38    ...
39  }
40  catch (Exception e)
41  {
42    handleError(&quot;fileOpenFailed&quot;, 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&lt;string, Dictionary&lt;string,string&gt;&gt; errorDefinitions
70    {
71        get;
72        set;
73    }
74}
75public ActionResult Index()
76{
77    var configuration = new ConfigurationBuilder()
78                        .SetBasePath(Directory.GetCurrentDirectory())
79                        .AddJsonFile(&quot;errordefinitions.json&quot;, false)
80                        .Build();
81
82    var config = configuration.Get&lt;ErrorDefinition&gt;();
83    var data = config.errorDefinitions[&quot;fileOpenFailed&quot;]
84                        .FirstOrDefault(x=&gt;x.Key== &quot;logMessage&quot;).Value;
85    return View();
86}
87{
88  &quot;errorDefinitions&quot;: {
89    &quot;unsupportedExtension&quot;: {
90      &quot;errorLevel&quot;: 2,
91      &quot;doLog&quot;: true,
92      &quot;logMessage&quot;: &quot;The file {0} doesn't have a valid extension for this operation.&quot;,
93      &quot;doEmail&quot;: false,
94      &quot;emailSubject&quot;: &quot;&quot;,
95      &quot;emailBody&quot;: &quot;&quot;
96    },
97    &quot;fileOpenFailed&quot;: {
98      &quot;errorLevel&quot;: 3,
99      &quot;doLog&quot;: true,
100      &quot;logMessage&quot;: &quot;The file {0} cannot be opened.&quot;,
101      &quot;doEmail&quot;: false,
102      &quot;emailSubject&quot;: &quot;&quot;,
103      &quot;emailBody&quot;: &quot;&quot;
104    }
105  }
106}
107

Result:

enter image description here

Source https://stackoverflow.com/questions/65711967

QUESTION

unable to uprade marklogic data hub framework using gradle

Asked 2020-Dec-14 at 06:04

I 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&gt; 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: {&quot;errorResponse&quot;:   {&quot;statusCode&quot;:401,
27   &quot;status&quot;:&quot;Unauthorized&quot;,
28   &quot;message&quot;:&quot;401 Unauthorized&quot;
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&gt; 401 Unauthorized: [{&quot;errorResponse&quot;:   {&quot;statusCode&quot;:401,
38     &quot;status&quot;:&quot;Unauthorized&quot;,
39     &quot;message&quot;:&quot;401 Unauthorized&quot;
40    }
41  }]
42

ANSWER

Answered 2020-Dec-14 at 06:04

Assuming you have followed the DHF upgrade matrix:

1&gt; 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: {&quot;errorResponse&quot;:   {&quot;statusCode&quot;:401,
27   &quot;status&quot;:&quot;Unauthorized&quot;,
28   &quot;message&quot;:&quot;401 Unauthorized&quot;
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&gt; 401 Unauthorized: [{&quot;errorResponse&quot;:   {&quot;statusCode&quot;:401,
38     &quot;status&quot;:&quot;Unauthorized&quot;,
39     &quot;message&quot;:&quot;401 Unauthorized&quot;
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&gt; 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: {&quot;errorResponse&quot;:   {&quot;statusCode&quot;:401,
27   &quot;status&quot;:&quot;Unauthorized&quot;,
28   &quot;message&quot;:&quot;401 Unauthorized&quot;
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&gt; 401 Unauthorized: [{&quot;errorResponse&quot;:   {&quot;statusCode&quot;:401,
38     &quot;status&quot;:&quot;Unauthorized&quot;,
39     &quot;message&quot;:&quot;401 Unauthorized&quot;
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&gt; 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: {&quot;errorResponse&quot;:   {&quot;statusCode&quot;:401,
27   &quot;status&quot;:&quot;Unauthorized&quot;,
28   &quot;message&quot;:&quot;401 Unauthorized&quot;
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&gt; 401 Unauthorized: [{&quot;errorResponse&quot;:   {&quot;statusCode&quot;:401,
38     &quot;status&quot;:&quot;Unauthorized&quot;,
39     &quot;message&quot;:&quot;401 Unauthorized&quot;
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

Source https://stackoverflow.com/questions/65283173

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

Share this Page

share link

Get latest updates on Configuration Management